aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorChuck Tuffli <chuck@FreeBSD.org>2018-06-22 00:02:03 +0000
committerChuck Tuffli <chuck@FreeBSD.org>2018-06-22 00:02:03 +0000
commit3575504976b2df6dd75e383f19d609d9385490f2 (patch)
treec293d6e44f8803acab575ed1a71759791c8d68ed /sys/compat
parent03d7aee8a7c1ca1dfda1a6a4521bc5f6ffa1e0e3 (diff)
downloadsrc-3575504976b2df6dd75e383f19d609d9385490f2.tar.gz
src-3575504976b2df6dd75e383f19d609d9385490f2.zip
Fix the Linux kernel version number calculation
The Linux compatibility code was converting the version number (e.g. 2.6.32) in two different ways and then comparing the results. The linux_map_osrel() function converted MAJOR.MINOR.PATCH similar to what FreeBSD does natively. I.e. where major=v0, minor=v1, and patch=v2 v = v0 * 1000000 + v1 * 1000 + v2; The LINUX_KERNVER() macro, on the other hand, converted the value with bit shifts. I.e. where major=a, minor=b, and patch=c v = (((a) << 16) + ((b) << 8) + (c)) The Linux kernel uses the later format via the KERNEL_VERSION() macro in include/generated/uapi/linux/version.h Fix is to use the LINUX_KERNVER() macro in linux_map_osrel() as well as in the .trans_osrel functions. PR: 229209 Reviewed by: emaste, cem, imp (mentor) Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D15952
Notes
Notes: svn path=/head/; revision=335515
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_mib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c
index 001ae545539a..99c7065f72dc 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)