提交 41370d3b 编写于 作者: S Sam Ravnborg

kbuild: do not segfault in modpost if MODVERDIR is not defined

A combination of calling modpost with option -a and MODVERDIR undefined
caused segmentation fault. So provide a default value and accept the
error messages it generates instead.
Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
上级 9d6e7a70
...@@ -381,8 +381,11 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) ...@@ -381,8 +381,11 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
struct md4_ctx md; struct md4_ctx md;
char *sources, *end, *fname; char *sources, *end, *fname;
const char *basename; const char *basename;
char filelist[strlen(getenv("MODVERDIR")) + strlen("/") + char filelist[PATH_MAX + 1];
strlen(modname) - strlen(".o") + strlen(".mod") + 1 ]; char *modverdir = getenv("MODVERDIR");
if (!modverdir)
modverdir = ".";
/* Source files for module are in .tmp_versions/modname.mod, /* Source files for module are in .tmp_versions/modname.mod,
after the first line. */ after the first line. */
...@@ -390,7 +393,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) ...@@ -390,7 +393,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
basename = strrchr(modname, '/') + 1; basename = strrchr(modname, '/') + 1;
else else
basename = modname; basename = modname;
sprintf(filelist, "%s/%.*s.mod", getenv("MODVERDIR"), sprintf(filelist, "%s/%.*s.mod", modverdir,
(int) strlen(basename) - 2, basename); (int) strlen(basename) - 2, basename);
file = grab_file(filelist, &len); file = grab_file(filelist, &len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册