From: Wang Wensheng wangwensheng4@huawei.com
hulk inclusion category: bugfix bugzilla: 46847 CVE: NA
-----------------------------------------------
This reverts commit 0294076e7271eb007c1f9c48733a4ebba55d0064.
This series of patches could raise an issue on module built.
Signed-off-by: Wang Wensheng wangwensheng4@huawei.com Reviewed-by: Jian Cheng cj.chengjian@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- scripts/mod/sumversion.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index b7b52350d08e4..0f6dcb4011a85 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -304,8 +304,9 @@ static int is_static_library(const char *objfile) * to figure out source files. */ static int parse_source_files(const char *objfile, struct md4_ctx *md) { - char *cmd, *file, *line, *dir, *pos; + char *cmd, *file, *line, *dir; const char *base; + unsigned long flen, pos = 0; int dirlen, ret = 0, check_files = 0;
cmd = NOFAIL(malloc(strlen(objfile) + sizeof("..cmd"))); @@ -323,12 +324,14 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) strncpy(dir, objfile, dirlen); dir[dirlen] = '\0';
- file = read_text_file(cmd); - - pos = file; + file = grab_file(cmd, &flen); + if (!file) { + warn("could not find %s for %s\n", cmd, objfile); + goto out; + }
/* Sum all files in the same dir or subdirs. */ - while ((line = get_line(&pos))) { + while ((line = get_next_line(&pos, file, flen)) != NULL) { char* p = line;
if (strncmp(line, "source_", sizeof("source_")-1) == 0) { @@ -379,7 +382,8 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) /* Everyone parsed OK */ ret = 1; out_file: - free(file); + release_file(file, flen); +out: free(dir); free(cmd); return ret;