Re: [PATCH 2.6.24] Add new string functions real_strtoul and changekernel params to use them

From: Randy Dunlap
Date: Thu Jan 31 2008 - 21:48:23 EST


On Fri, 01 Feb 2008 00:30:17 +0800 Yi Yang wrote:

> On Thu, 2008-01-31 at 09:03 -0800, Randy Dunlap wrote:
> > On Thu, 31 Jan 2008 09:18:22 +0800 Yi Yang wrote:
> >
> > > Currently, for every sysfs node, the callers will be responsible for
> > > implementing store operation, so many many callers are doing duplicate
> > > things to validate input, they have the same mistakes because they are
> > > calling simple_strtol/ul/ll/ull, especially for module params, they are
> > > just numeric, but you can echo such values as 0x1234xxx, 07777888 and
> > > 1234aaa, for these cases, module params store operation just ignores
> > > successive invalid char and converts prefix part to a numeric although
> > > input is actually invalid.
> > >
> > > This patch tries to fix the aforementioned issues and implements real_strtox
> > > serial functions, kernel/params.c uses them to strictly validate input,
> > > so module params will reject such values as 0x1234xxxx and returns an error:
> >
> > How about a prefix of safe_ or strict_ or something other than real_?
> > real_ sounds too much like a real number function string parser.
> >
> I named it as strict_ at the beginning, but it results in some alignment
> issues checkpatch.pl will always warn, i don't know if warnings will
> make the patch out of the door.
>
> In kernel/params.c, STANDARD_PARAM_DEF(a function definition macro) will
> be over 80 chars, is it correct coding style to split it to two lines?

Yes, if it can be done cleanly. Otherwise just leave it long (IMHO).

---
~Randy
--
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/