lkml.org 
[lkml]   [2012]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sscanf: don't ignore field widths for numeric conversions
>>> On 02.11.12 at 22:32, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 02 Nov 2012 14:44:08 +0000
> "Jan Beulich" <JBeulich@suse.com> wrote:
>
>> This is another step towards better standard conformance. Rather than
>> adding a local buffer to store the specified portion of the string
>> (with the need to enforce an arbitrary maximum supported width to
>> limit the buffer size), do a maximum width conversion and then drop as
>> much of it as is necessary to meet the caller's request.
>>
>> Also fail on negative field widths.
>>
>> ...
>>
>> + simple_strtol(str, &next, base) :
>
> simple_strtol() kerndoc says "This function is obsolete. Please use
> kstrtol instead." Can we?

No, we can't - kstrtoXX() fail on non-zero terminated strings. If
anything we'd have to switch to using the parsing functions
underlying _kstrtoXX() (effectively open-coding simple_strtoXX()),
but other than a simply replacement as you suggest (and as I had
intended originally) I wouldn't want to put _that_ change into this
same patch.

I think the simple_strtoXX() functions are sitting inside lib/vsprintf.c
for a good reason, and the obsoletion aspect of them should
merely involve their status of not only not being static, but even
being exported. Their use as helper functions ought to be fine
within that file.

Jan



\
 
 \ /
  Last update: 2012-11-05 10:42    [W:0.739 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site