History

scripts: modpost: fix compilation warning

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.

Michal Nazarewicz committed 12 years ago

Commit fcd38ed1 parent 37549e91 file · +4 −5Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/mod/modpost.c+4−5
@@ -1703,12 +1703,11 @@ static void check_sec_ref(struct module *mod, const char *modname, · 1702 unmodified lines
17031703
17041704 static char *remove_dot(char *s)
17051705 {
1706− char *end;
1707− int n = strcspn(s, ".");
1706+ size_t n = strcspn(s, ".");
17081707
1709− if (n > 0 && s[n] != 0) {
1710− strtoul(s + n + 1, &end, 10);
1711− if (end > s + n + 1 && (*end == '.' || *end == 0))
1708+ if (n && s[n]) {
1709+ size_t m = strspn(s + n + 1, "0123456789");
1710+ if (m && (s[n + m] == '.' || s[n + m] == 0))
17121711 s[n] = 0;
17131712 }
17141713 return s;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t