All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Zhen <zhenzhang.zhang@huawei.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: MTD Maling List <linux-mtd@lists.infradead.org>,
	Hu Jianyang <hujianyang@huawei.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [PATCH v2] UBIFS: replace simple_strtoul() with kstrtoint()
Date: Wed, 21 May 2014 10:22:41 +0800	[thread overview]
Message-ID: <537C0DF1.50309@huawei.com> (raw)
In-Reply-To: <CAMuHMdVKz1cvRiCp0Ni1Sv+=n3z78tWZ0w6ijfaGMjunb9oZag@mail.gmail.com>

On 2014/5/20 20:55, Geert Uytterhoeven wrote:
> On Tue, May 20, 2014 at 2:45 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>>> +     ret = kstrtoint(endptr, 0, &dev);
>>>>
>>>> But endptr is used in the code later, so this is wrong.
>>>
>>> That was my first thought, too. But upon closer look, I think it's correct.
>>>
>>>>>
>>>>>       /* ubiY method */
>>>>> -     if (*endptr == '\0')
>>>
>>> endptr would point to the trailing nul on success...
>>>
>>>>> +     if (!ret)
>>>
>>> ... which is now replaced by a test for ret not being an errorcoe.
>>>
>>>>>               return ubi_open_volume(0, dev, mode);
>>>>>
>>>>>       /* ubiX_Y method */
>>>
>>> If ret is an errorcode, the flow continues.
>>>
>>> As parsing the number failed, the code checks if the first character
>>> (name + 3) is an underscore or colon:
>>
>> No, it does not check if parsing failed, it checks for end-of-input.
>> The "X" and "Y" of "ubiX_Y" are numbers.
Sorry, i made a mistake. As parsing the number failed, it should just return
ERR_PTR(-EINVAL).

Thank you for your review. I learned a lot from you and Geert.
I will send another version.
> 
> Sorry, you're right. Thanks for noticing!
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 
> 

      reply	other threads:[~2014-05-21  2:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1400575582-24841-1-git-send-email-zhenzhang.zhang@huawei.com>
2014-05-20  8:48 ` [PATCH v2] UBIFS: replace simple_strtoul() with kstrtoint() Zhang Zhen
2014-05-20 12:21   ` Adrian Hunter
2014-05-20 12:31     ` Geert Uytterhoeven
2014-05-20 12:45       ` Adrian Hunter
2014-05-20 12:55         ` Geert Uytterhoeven
2014-05-21  2:22           ` Zhang Zhen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=537C0DF1.50309@huawei.com \
    --to=zhenzhang.zhang@huawei.com \
    --cc=adrian.hunter@intel.com \
    --cc=dedekind1@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=hujianyang@huawei.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.