Skip to contentSkip to conversation

staging: Note that simple_strtoul can't simply be replaced by kstrtoul

PATCH In review Samuel Thibault 2 participants 3 messages Feb 23, 2019 – Feb 24, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: Note that simple_strtoul can't simply be replaced by kstrtoul

We often receive patches which erroneously try to use kstrtoul in these places.

---
 drivers/staging/speakup/kobjects.c    |    2 ++
 drivers/staging/speakup/main.c        |    1 +
 drivers/staging/speakup/varhandlers.c |    1 +
 3 files changed, 4 insertions(+)
drivers/staging/speakup/kobjects.c +2 -0
@@ -154,6 +154,7 @@ static ssize_t chars_chartab_store(struc
 			continue;
 		}
 
+		/* Do not replace with kstrtoul: here we need temp to be updated */
 		index = simple_strtoul(cp, &temp, 10);
 		if (index > 255) {
 			rejected++;
@@ -787,6 +788,7 @@ static ssize_t message_store_helper(cons
 			continue;
 		}
 
+		/* Do not replace with kstrtoul: here we need temp to be updated */
 		index = simple_strtoul(cp, &temp, 10);
 
 		while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
drivers/staging/speakup/main.c +1 -0
@@ -1979,6 +1979,7 @@ oops:
 		return 1;
 	}
 
+	/* Do not replace with kstrtoul: here we need cp to be updated */
 	goto_pos = simple_strtoul(goto_buf, &cp, 10);
 
 	if (*cp == 'x') {
drivers/staging/speakup/varhandlers.c +1 -0
@@ -328,6 +328,7 @@ char *spk_s2uchar(char *start, char *des
 {
 	int val;
 
+	/* Do not replace with kstrtoul: here we need start to be updated */
 	val = simple_strtoul(skip_spaces(start), &start, 10);
 	if (*start == ',')
 		start++;
maintainer
#1 lore raw
Quoted 4 lines · Samuel Thibault

We often receive patches which erroneously try to use kstrtoul in these places.

Awe, it's fun to try to see people do this and not really think about the consequences :)

Anyway, seriously, thanks for this, I'll go queue it up later today...

greg k-h

#2 lore raw

Greg KH, le dim. 24 févr. 2019 08:59:21 +0100, a ecrit:

Quoted 8 lines · Samuel Thibault
Quoted 4 lines

We often receive patches which erroneously try to use kstrtoul in these places.

Awe, it's fun to try to see people do this and not really think about the consequences :)

Sure :)
But I have to say I'm a bit scared one of these could pass through :)

Quoted 1 line

Anyway, seriously, thanks for this, I'll go queue it up later today...

Thanks!

Samuel