From: Ben Hutchings Date: Wed, 22 Mar 2023 18:11:45 +0000 (+0100) Subject: modpost: Fix processing of CRCs on 32-bit build machines X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0e7ac17634d2254e0fc65307a5f430e4f1fdb7e9;p=users%2Fjedix%2Flinux-maple.git modpost: Fix processing of CRCs on 32-bit build machines commit fb27e70f6e408dee5d22b083e7a38a59e6118253 upstream. modpost now reads CRCs from .*.cmd files, parsing them using strtol(). This is inconsistent with its parsing of Module.symvers and with their definition as *unsigned* 32-bit values. strtol() clamps values to [LONG_MIN, LONG_MAX], and when building on a 32-bit system this changes all CRCs >= 0x80000000 to be 0x7fffffff. Change extract_crcs_for_object() to use strtoul() instead. Cc: stable@vger.kernel.org Fixes: f292d875d0dc ("modpost: extract symbol versions from *.cmd files") Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada Signed-off-by: Greg Kroah-Hartman --- diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 2c80da0220c32..1dfa80c6b471e 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1722,7 +1722,7 @@ static void extract_crcs_for_object(const char *object, struct module *mod) if (!isdigit(*p)) continue; /* skip this line */ - crc = strtol(p, &p, 0); + crc = strtoul(p, &p, 0); if (*p != '\n') continue; /* skip this line */