summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRadek Krejci <radek.krejci@oracle.com>2024-02-14 10:14:07 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-02-23 09:12:35 +0100
commit3e409fb74007a6d1dc85073a0eb67681bd49f6a5 (patch)
tree5448c1340f484b1e451936d27ddc831d9986e423 /scripts
parent491528935c9c48bf341d8b40eabc6c4fc5df6f2c (diff)
modpost: trim leading spaces when processing source files list
[ 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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/sumversion.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index 6bf9caca0968..a72e6cf61a1f 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -326,7 +326,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, ' ');