[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1111090710000.1899@hadrien>
Date: Wed, 9 Nov 2011 07:15:32 +0100 (CET)
From: Julia Lawall <julia.lawall@...6.fr>
To: Alexey Dobriyan <adobriyan@...il.com>
cc: "J. Bruce Fields" <bfields@...ldses.org>,
kernel-janitors@...r.kernel.org, Neil Brown <neilb@...e.de>,
Trond Myklebust <Trond.Myklebust@...app.com>,
"David S. Miller" <davem@...emloft.net>, linux-nfs@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] net/sunrpc: use kstrtoul, etc
In looking through some examples, I see, e.g.:
if (strict_strtoul(buf, 10, &val) < 0)
return -EINVAL;
if (val < 1 || val > 2)
return -EINVAL;
In this case the only valid values are 1 and 2, which are much smaller
than the u8 range. Is it useful to use kstrtou8 anyway? I see that
kstrtou8 returns -ERANGE not -EINVAL when the value is out of bounds. If
kstrtou8 is to be used, should the subsequent if (val < 1 || val > 2) now
return -ERANGE to be consistent?
julia
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists