aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/mod/modpost.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 9d9c5b905b35..5ba203b9eddf 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,
1703 1703
1704static char *remove_dot(char *s) 1704static char *remove_dot(char *s)
1705{ 1705{
1706 char *end; 1706 size_t n = strcspn(s, ".");
1707 int n = strcspn(s, ".");
1708 1707
1709 if (n > 0 && s[n] != 0) { 1708 if (n && s[n]) {
1710 strtoul(s + n + 1, &end, 10); 1709 size_t m = strspn(s + n + 1, "0123456789");
1711 if (end > s + n + 1 && (*end == '.' || *end == 0)) 1710 if (m && (s[n + m] == '.' || s[n + m] == 0))
1712 s[n] = 0; 1711 s[n] = 0;
1713 } 1712 }
1714 return s; 1713 return s;