From bb0ed3f6d91f19447732f667dac077dfd7338d57 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 7 Feb 2021 00:56:44 +0100 Subject: 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 --- src/compat/Kbuild.include | 1 + src/compat/version/linux/version.h | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 src/compat/version/linux/version.h 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 . All Rights Reserved. + */ + +#include_next +#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) -- cgit v1.2.3-59-g8ed1b