[PATCH] staging: speakup: remove simple_strtoul()

Gabriel Fedel fedel at fedel.net.br
Sun May 20 16:06:06 EDT 2018


Hi Justin,

Em 20-05-2018 06:22, Justin Skists escreveu:
>
>
> On 20 May 2018 09:59:00 BST, Justin Skists <justin.skists at juzza.co.uk> wrote:
>>
>>
>> Hi Gabriel,
>>
>> On 19 May 2018 23:02:36 BST, Gabriel Fedel <fedel at fedel.net.br> wrote:
>>> Replace simple_strtoul() with kstrtoul(), because simple_strtoul() is
>>> obsolete
>>>
>>> Signed-off-by: Gabriel Fedel <fedel at fedel.net.br>
>>> ---
>>>  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");
>>> +
>>>  		if (index > 255) {
>>>  			rejected++;
>>>  			cp = linefeed + 1;
>>> @@ -787,7 +789,8 @@ static ssize_t message_store_helper(const char
>>> *buf,
>>> size_t count,
>>>  			continue;
>>>  		}
>>>
>>> -		index = simple_strtoul(cp, &temp, 10);
>>> +		if kstrtoul((char *)cp, 10, &index) != 0
>>> +			pr_warn("overflow or parsing error has occurred");
>>>
>>>  		while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
>>>  			temp++;
>>
>> Sorry. simple_strtoul() would've updated temp which would mean the
>> behaviour at this while loop is now different.
>
> Oops. I shouldn't review patches without coffee. With a closer look at what the while loop was doing, I don't think it is a real issue.
>
> Best regards,
> Justin
>
Just to check, so is there no problem with temp on this change, right?

Thank you,

Regards
Gabriel


More information about the Speakup mailing list