diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-02-07 00:56:44 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-02-07 18:03:47 +0100 |
commit | bb0ed3f6d91f19447732f667dac077dfd7338d57 (patch) | |
tree | 7f49021816fe3f69b27877ddffc73f3717128f04 | |
parent | 897b4b9152d3680da1db4c380aaa48a52313c680 (diff) |
compat: redefine version constants for sublevel>=256
With the 4.4.256 and 4.9.256 kernels, the previous calculation for
integer comparison overflowed. This commit redefines the broken
constants to have more space for the sublevel.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/compat/Kbuild.include | 1 | ||||
-rw-r--r-- | src/compat/version/linux/version.h | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/compat/Kbuild.include b/src/compat/Kbuild.include index e937671..209c0cc 100644 --- a/src/compat/Kbuild.include +++ b/src/compat/Kbuild.include @@ -6,6 +6,7 @@ kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) ccflags-y += -include $(kbuild-dir)/compat/compat.h asflags-y += -include $(kbuild-dir)/compat/compat-asm.h +LINUXINCLUDE := -DCOMPAT_VERSION=$(VERSION) -DCOMPAT_PATCHLEVEL=$(PATCHLEVEL) -DCOMPAT_SUBLEVEL=$(SUBLEVEL) -I$(kbuild-dir)/compat/version $(LINUXINCLUDE) ifeq ($(wildcard $(srctree)/include/linux/ptr_ring.h),) ccflags-y += -I$(kbuild-dir)/compat/ptr_ring/include diff --git a/src/compat/version/linux/version.h b/src/compat/version/linux/version.h new file mode 100644 index 0000000..90988b3 --- /dev/null +++ b/src/compat/version/linux/version.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2015-2021 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. + */ + +#include_next <linux/version.h> +#undef KERNEL_VERSION +#define KERNEL_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + (c)) +#undef LINUX_VERSION_CODE +#define LINUX_VERSION_CODE KERNEL_VERSION(COMPAT_VERSION, COMPAT_PATCHLEVEL, COMPAT_SUBLEVEL) |