Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
modpost: trim leading spaces when processing source files list
Browse files Browse the repository at this point in the history
[ Upstream commit 5d9a16b ]

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: 70f30cf ("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>
  • Loading branch information
rkrejci authored and gregkh committed Feb 21, 2024
1 parent 7ef0fae commit f06397e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/mod/sumversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, ' ');
Expand Down

0 comments on commit f06397e

Please sign in to comment.