On Thu, 24 Feb 2011, mark gross wrote: > > How careful do you want to be here? For example, which of the > > following inputs do you want to accept? > > > > 0x1234 > > abcd1234 > > abcd123456 > > abcd123456\n > > abcd1234567 > > 1234567890 > > 1234567890\n > > 12345678901 > > > 0x12345678 > > 0x12345678\n > just these 2 are what I had planned to allow after this email thread. > > > 0x123456789 > > > > Maybe it's okay to be a little relaxed about this, and trust the caller > > to pass in data that makes sense. > yeah but is it worth the effort? Checking for exactly those two forms really is a lot of effort. You have to make sure the first two characters are "0x" or "0X", you have to check that each of the next eight characters is a valid hex digit, and you have to verify that the 11th character, if present, is a newline. If you can get results that are good enough just by calling strict_strtoul() without all these checks, it's probably worthwhile. Alan Stern _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm