* [PATCH] modpost: Fix processing of CRCs on 32-bit build machines
@ 2023-03-22 18:11 Ben Hutchings
2023-03-23 6:20 ` Masahiro Yamada
0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2023-03-22 18:11 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, stable
[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]
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 <ben@decadent.org.uk>
---
scripts/mod/modpost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index efff8078e395..9466b6a2abae 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1733,7 +1733,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 */
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] modpost: Fix processing of CRCs on 32-bit build machines
2023-03-22 18:11 [PATCH] modpost: Fix processing of CRCs on 32-bit build machines Ben Hutchings
@ 2023-03-23 6:20 ` Masahiro Yamada
0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2023-03-23 6:20 UTC (permalink / raw)
To: Ben Hutchings; +Cc: linux-kbuild, stable
On Thu, Mar 23, 2023 at 3:11 AM Ben Hutchings <ben@decadent.org.uk> wrote:
>
> 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 <ben@decadent.org.uk>
> ---
Applied to linux-kbuild/fixes.
Thanks.
> scripts/mod/modpost.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index efff8078e395..9466b6a2abae 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1733,7 +1733,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 */
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-23 6:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-22 18:11 [PATCH] modpost: Fix processing of CRCs on 32-bit build machines Ben Hutchings
2023-03-23 6:20 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox