On 12-07-09 04:29 PM, Andrew Morton wrote: > On Thu, 05 Jul 2012 07:52:25 -0700 > Robert Love<robert.w.love@xxxxxxxxx> 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-- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html