lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 8 Feb 2021 09:38:05 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     David Laight <David.Laight@...LAB.COM>, 'Willy Tarreau' <w@....eu>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
CC:     Guenter Roeck <linux@...ck-us.net>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>,
        "lwn@....net" <lwn@....net>, "jslaby@...e.cz" <jslaby@...e.cz>,
        "shuah@...nel.org" <shuah@...nel.org>,
        "patches@...nelci.org" <patches@...nelci.org>,
        "lkft-triage@...ts.linaro.org" <lkft-triage@...ts.linaro.org>,
        "pavel@...x.de" <pavel@...x.de>,
        "jonathanh@...dia.com" <jonathanh@...dia.com>
Subject: RE: Linux 4.4.256

From: David Laight
> Sent: 08 February 2021 09:10
> 
> From: Willy Tarreau
> > Sent: 06 February 2021 13:23
> >
> > On Sat, Feb 06, 2021 at 02:11:13PM +0100, Willy Tarreau wrote:
> > > Something like this looks more robust to me, it will use SUBLEVEL for
> > > values 0 to 255 and 255 for any larger value:
> >
> > diff --git a/Makefile b/Makefile
> > index 7d86ad6ad36c..9b91b8815b40 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1252,7 +1252,7 @@ endef
> >
> >  define filechk_version.h
> >  	echo \#define LINUX_VERSION_CODE $(shell                         \
> > -	expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
> > +	expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 255 \* \( 0$(SUBLEVEL) \> 255 \) +
> > 0$(SUBLEVEL) \* \( 0$(SUBLEVEL) \<= 255 \) ); \
> >  	echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'
> >  endef
> 
> Why not:
> 	$(shell echo $$(($(VERSION)<<16 + $(PATCHLEVEL)<<8 + ($(SUBVERSION) < 255 ? $(SUBVERSION) :
> 255))))
> Untested, but I think only the one $ needs any kind of escape.
> The extra leading zeros do have to go - $((...)) does octal :-(

Or probably even better:

echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))'
echo '#define LINUX_VERSION_CODE KERNEL_VERSION($(VERSION), $(PATCHLEVEL)+0, $(SUBLEVEL)+0)'

Which gets rid of the $(shell) as well.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ