Re: [PATCH 2/5] net/sunrpc: use kstrtoul, etc

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

 



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 kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux