diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index d5150579212..afa06bb415c 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -799,10 +799,11 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel) return (false); /* - * For Linux we encode osrel as follows (see linux_mib.c): - * VVVMMMIII (version, major, minor), see linux_mib.c. + * For Linux we encode osrel using the Linux convention of + * (version << 16) | (major << 8) | (minor) + * See macro in linux_mib.h */ - *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3]; + *osrel = LINUX_KERNVER(desc[1], desc[2], desc[3]); return (true); } diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 648456dc718..66d441e96c6 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -993,10 +993,11 @@ linux32_trans_osrel(const Elf_Note *note, int32_t *osrel) return (false); /* - * For Linux we encode osrel as follows (see linux_mib.c): - * VVVMMMIII (version, major, minor), see linux_mib.c. + * For Linux we encode osrel using the Linux convention of + * (version << 16) | (major << 8) | (minor) + * See macro in linux_mib.h */ - *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3]; + *osrel = LINUX_KERNVER(desc[1], desc[2], desc[3]); return (true); } diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c index 001ae545539..99c7065f72d 100644 --- a/sys/compat/linux/linux_mib.c +++ b/sys/compat/linux/linux_mib.c @@ -149,8 +149,8 @@ linux_map_osrel(char *osrelease, int *osrel) if (osrelease == sep || sep != eosrelease) return (EINVAL); - v = v0 * 1000000 + v1 * 1000 + v2; - if (v < 1000000) + v = LINUX_KERNVER(v0, v1, v2); + if (v < LINUX_KERNVER(1, 0, 0)) return (EINVAL); if (osrel != NULL) diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index b3e84cb5cdc..d379a6e8f84 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -970,10 +970,11 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel) return (false); /* - * For Linux we encode osrel as follows (see linux_mib.c): - * VVVMMMIII (version, major, minor), see linux_mib.c. + * For Linux we encode osrel using the Linux convention of + * (version << 16) | (major << 8) | (minor) + * See macro in linux_mib.h */ - *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3]; + *osrel = LINUX_KERNVER(desc[1], desc[2], desc[3]); return (true); }