From fcd38ed0ff263156c3917c70c2fb0b7e91bfeab1 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Sun, 27 Jul 2014 07:27:01 +0930 Subject: scripts: modpost: fix compilation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The scripts/mod/modpost.c triggers the following warning: scripts/mod/modpost.c: In function ‘remove_dot’: scripts/mod/modpost.c:1710:10: warning: ignoring return value of ‘strtoul’, declared with attribute warn_unused_result [-Wunused-result] The remove_dot function that calls strtoul does not care about the numeric value of the string that is parsed but only looks for the end of the numeric sequence. As such, it's equivalent to just skip over all digits. Signed-off-by: Michal Nazarewicz Signed-off-by: Rusty Russell --- scripts/mod/modpost.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 9d9c5b905b359..5ba203b9eddf9 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1703,12 +1703,11 @@ static void check_sec_ref(struct module *mod, const char *modname, static char *remove_dot(char *s) { - char *end; - int n = strcspn(s, "."); + size_t n = strcspn(s, "."); - if (n > 0 && s[n] != 0) { - strtoul(s + n + 1, &end, 10); - if (end > s + n + 1 && (*end == '.' || *end == 0)) + if (n && s[n]) { + size_t m = strspn(s + n + 1, "0123456789"); + if (m && (s[n + m] == '.' || s[n + m] == 0)) s[n] = 0; } return s; -- cgit v1.2.3