From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13A60C433E0 for ; Sat, 6 Feb 2021 13:23:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C559C64EB9 for ; Sat, 6 Feb 2021 13:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229522AbhBFNXt (ORCPT ); Sat, 6 Feb 2021 08:23:49 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:49662 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbhBFNXt (ORCPT ); Sat, 6 Feb 2021 08:23:49 -0500 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 116DMdTx022974; Sat, 6 Feb 2021 14:22:39 +0100 Date: Sat, 6 Feb 2021 14:22:39 +0100 From: Willy Tarreau To: Greg Kroah-Hartman Cc: Guenter Roeck , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, torvalds@linux-foundation.org, stable@vger.kernel.org, lwn@lwn.net, jslaby@suse.cz, shuah@kernel.org, patches@kernelci.org, lkft-triage@lists.linaro.org, pavel@denx.de, jonathanh@nvidia.com Subject: Re: Linux 4.4.256 Message-ID: <20210206132239.GC7312@1wt.eu> References: <1612534196241236@kroah.com> <20210205205658.GA136925@roeck-us.net> <20210206131113.GB7312@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210206131113.GB7312@1wt.eu> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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: > > - expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \ > + expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 255 \* (0$(SUBLEVEL) > 255) + 0$(SUBLEVEL) * (0$(SUBLEVEL \<= 255)); \ Bah, I obviously missed a backslash above and forgot spaces around parens. Here's a tested version: 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 Willy