lkml.org 
[lkml]   [2006]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 17/46] kbuild: do not segfault in modpost if MODVERDIR is not defined
Date
From
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: Sam Ravnborg <sam@ravnborg.org>

---

scripts/mod/sumversion.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)

41370d3b5ec6401c5cf0df82297ed989c03a64bd
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index 5c07545..8a28756 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -381,8 +381,11 @@ void get_src_version(const char *modname
struct md4_ctx md;
char *sources, *end, *fname;
const char *basename;
- char filelist[strlen(getenv("MODVERDIR")) + strlen("/") +
- strlen(modname) - strlen(".o") + strlen(".mod") + 1 ];
+ char filelist[PATH_MAX + 1];
+ char *modverdir = getenv("MODVERDIR");
+
+ if (!modverdir)
+ modverdir = ".";

/* Source files for module are in .tmp_versions/modname.mod,
after the first line. */
@@ -390,7 +393,7 @@ void get_src_version(const char *modname
basename = strrchr(modname, '/') + 1;
else
basename = modname;
- sprintf(filelist, "%s/%.*s.mod", getenv("MODVERDIR"),
+ sprintf(filelist, "%s/%.*s.mod", modverdir,
(int) strlen(basename) - 2, basename);

file = grab_file(filelist, &len);
--
1.0.GIT

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-03-21 17:30    [W:0.532 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site