[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1210188046.19279.42.camel@brick>
Date: Wed, 07 May 2008 12:20:46 -0700
From: Harvey Harrison <harvey.harrison@...il.com>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] lib: vsprintf.c remove macros defining strict
string functions
On Thu, 2008-05-08 at 00:09 +0400, Alexey Dobriyan wrote:
> On Wed, May 07, 2008 at 11:25:29AM -0700, Harvey Harrison wrote:
> > Directly code the strict string conversion functions rather than using
> > defining macros. Pull out a small helper to check the strict conditions
> > required at the end of a string (nul-terminated or newline).
>
> > Add additional checks in strict_strtol and strict_strtoll for numeric
> > overflow of the signed types.
>
> C interer ranges are asymmetric.
Yes, and LLONG_MAX = -LLONG_MIN + 1...so it will reject string values
of LLONG_MIN...easily fixed if we want it I guess.
>
> These "strict_" functions are a farce. No amount of afterchecking will
> save you if there is trivial wraparound in core function.
>
That's also true, I guess it depends on how far we want to go. And
after that point, just stick a WARN_ON and return -EINVAL.
I'm not sure where the balance is, but I think my patch is still on
the useful side of it.
> Alexey "kstrtonum" Dobriyan
>
> > + */
> > +static int strict_checktail(size_t len, const char *cp, const char *tail)
>
> Name simply sucks.
Sure does, care to suggest something better, at least it had a
comment ;-)
Anyways, thanks for taking a look.
Harvey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists