Re: [PATCH 2/5] net/sunrpc: use kstrtoul, etc
From: Julia Lawall
Date: Wed Nov 09 2011 - 01:15:36 EST
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/