]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
modpost: trim leading spaces when processing source files list
authorRadek Krejci <radek.krejci@oracle.com>
Wed, 14 Feb 2024 09:14:07 +0000 (10:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:42:25 +0000 (08:42 +0100)
[ Upstream commit 5d9a16b2a4d9e8fa028892ded43f6501bc2969e5 ]

get_line() does not trim the leading spaces, but the
parse_source_files() expects to get lines with source files paths where
the first space occurs after the file path.

Fixes: 70f30cfe5b89 ("modpost: use read_text_file() and get_line() for reading text files")
Signed-off-by: Radek Krejci <radek.krejci@oracle.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
scripts/mod/sumversion.c

index d587f40f11177ddb81f724757809c633b77195e5..b6eda411be154c39d7d351c51061a7c8b2abb9b5 100644 (file)
@@ -328,7 +328,12 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
 
        /* Sum all files in the same dir or subdirs. */
        while ((line = get_line(&pos))) {
-               char* p = line;
+               char* p;
+
+               /* trim the leading spaces away */
+               while (isspace(*line))
+                       line++;
+               p = line;
 
                if (strncmp(line, "source_", sizeof("source_")-1) == 0) {
                        p = strrchr(line, ' ');