Re: [PATCH] kbuild: give SUBLEVEL more room in KERNEL_VERSION

From: Greg KH
Date: Mon Jan 18 2021 - 11:41:43 EST


On Mon, Jan 18, 2021 at 10:31:35AM -0500, Sasha Levin wrote:
> On Mon, Jan 18, 2021 at 02:52:02PM +0100, Greg KH wrote:
> > On Mon, Jan 18, 2021 at 08:39:59AM -0500, Sasha Levin wrote:
> > > I think it would also affect code that doesn't do things based on
> > > SBULEVEL. Consider something like:
> > >
> > > if (LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0))
> > >
> > > Which will cause 4.4.256 to now change the result of that comparison.
> >
> > Sure, but there are no in-kernel users like this, so my sympathy is
> > quite low :)
>
> Wouldn't it be an issue for the hacky in-kernel users too? For example,
> right now the USB code does:
>
> #define KERNEL_REL bin2bcd(((LINUX_VERSION_CODE >> 16) & 0x0ff))
> #define KERNEL_VER bin2bcd(((LINUX_VERSION_CODE >> 8) & 0x0ff))
>
> After 4.4.256, KERNEL_VER will be (5) rather than (4), indicating a
> version of 4.5.

Which, really, is just fine. This is an informational string that shows
up in 'lsusb' for root hubs. Same for V4L devices, they just want to
send some string to userspace. Yes, it might look odd, but nothing is
going to break, it's just a string :)

thanks,

greg k-h