From: "Love, Robert W" <robert.w.love@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"devel@open-fcoe.org" <devel@open-fcoe.org>
Subject: Re: [PATCH] fcoe: Remove redundant 'less than zero' check
Date: Mon, 9 Jul 2012 23:50:07 +0000 [thread overview]
Message-ID: <4FFB6E2D.7010506@intel.com> (raw)
In-Reply-To: <20120709162939.9d0481e7.akpm@linux-foundation.org>
On 12-07-09 04:29 PM, Andrew Morton wrote:
> On Thu, 05 Jul 2012 07:52:25 -0700
> Robert Love<robert.w.love@intel.com> wrote:
>
>> strtoul returns an 'unsigned long' so there is no
>> reason to check if the value is less than zero.
>>
>> strtoul already checks for the '-' character deep
>> in its bowels. It will return an error if the user
>> has provided a negative value and fcoe_str_to_dev_loss
>> will return that error to its caller.
> huh, I never knew that. So if we feed -1 to kstrtoul() it gets treated
> as an error? That seems a bit surprising. You're sure about that?
>
>
I believe so.
kstrtoul->kstrtoull->_kstrtoull->_parse_integer
When the call chain ultimately hits _parse_integer it breaks out of
parsing if it hits a non-numeric or alphabetic character outside of the
'a' to 'f' range. _kstrtoull notices that the buffer wasn't completely
parsed and returns an error. I think the error will be -EINVAL.
//Rob
next prev parent reply other threads:[~2012-07-09 23:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <829BE905228AE14A9AE1A46E6F2E371605538D039D@VA3DIAXVS891.RED001.local>
2012-07-03 22:27 ` New Defects based on recent changes in Kernel code found by Coverity Scan Andrew Morton
2012-07-03 23:05 ` Bing Zhao
[not found] ` <20120703152739.ea7df9e6.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2012-07-05 14:52 ` [PATCH] fcoe: Remove redundant 'less than zero' check Robert Love
2012-07-09 23:29 ` Andrew Morton
2012-07-09 23:50 ` Love, Robert W [this message]
2012-07-05 15:12 ` New Defects based on recent changes in Kernel code found by Coverity Scan Love, Robert W
2012-07-05 15:33 ` Chris Mason
2012-07-05 19:44 ` Andrew Morton
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=4FFB6E2D.7010506@intel.com \
--to=robert.w.love@intel.com \
--cc=akpm@linux-foundation.org \
--cc=devel@open-fcoe.org \
--cc=linux-scsi@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).