Re: [PATCH] staging: speakup: remove simple_strtoul()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em 20-05-2018 09:33, Greg KH escreveu:
On Sat, May 19, 2018 at 07:02:36PM -0300, Gabriel Fedel wrote:
Replace simple_strtoul() with kstrtoul(), because simple_strtoul() is
obsolete

Signed-off-by: Gabriel Fedel <fedel@xxxxxxxxxxxx>
---
 drivers/staging/speakup/kobjects.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/kobjects.c
b/drivers/staging/speakup/kobjects.c
index f1f9022..ddc5ac3 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -154,7 +154,9 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
 			continue;
 		}

-		index = simple_strtoul(cp, &temp, 10);
+		if  kstrtoul((char *)cp, 10, &index) != 0
+			pr_warn("overflow or parsing error has occurred");
+

Did you even build this code?
Sorry! I sent wrong patch version.

And kstrtoul is not a "drop in replacement" for simple_strtoul(),
otherwise we would have done that tree-wide fixup by now.  Please be
careful and understand the change, and the C language, when you make a
kernel code change.
You are right, I understand the wrong use now.

I working in another patch version, making adjustments to use kstrtoul, and I will send soon.


And again, always test-build your code.
Yes, this will not repeat.


thanks,
thank you, and sorry again for this very ugly patch


greg k-h


_______________________________________________
Speakup mailing list
Speakup@xxxxxxxxxxxxxxxxx
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup




[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]

  Powered by Linux