Re: kstrtox: convert net/sunrpc/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 01, 2011 at 12:57:41PM -0400, Chuck Lever wrote:
> On Mar 31, 2011, at 5:36 PM, Alexey Dobriyan wrote:
> 
> > * fix a bug in rpc_parse_scope_id() where successfull parsing of
> >  scope ID was an error.
> 
> What was the bad behavior?

rpc_parse_scope_id() always rejected scope ids, because strict_strtoul()
returned 0 on success.

> > --- a/net/sunrpc/addr.c
> > +++ b/net/sunrpc/addr.c
> > @@ -173,15 +173,15 @@ static int rpc_parse_scope_id(const char *buf, const size_t buflen,
> > 	len = (buf + buflen) - delim - 1;
> > 	p = kstrndup(delim + 1, len, GFP_KERNEL);
> > 	if (p) {
> > -		unsigned long scope_id = 0;
> > 		struct net_device *dev;
> > +		u32 scope_id;
> > 
> > 		dev = dev_get_by_name(&init_net, p);
> > 		if (dev != NULL) {
> > 			scope_id = dev->ifindex;
> > 			dev_put(dev);
> > 		} else {
> > -			if (strict_strtoul(p, 10, &scope_id) == 0) {
> > +			if (kstrtou32(p, 10, &scope_id) < 0) {
> > 				kfree(p);
> > 				return 0;
> > 			}
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux