From: Harvey Harrison <harvey.harrison@gmail.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] lib: vsprintf.c remove macros defining strict string functions
Date: Wed, 07 May 2008 12:20:46 -0700 [thread overview]
Message-ID: <1210188046.19279.42.camel@brick> (raw)
In-Reply-To: <20080507200909.GB5131@martell.zuzino.mipt.ru>
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
next prev parent reply other threads:[~2008-05-07 19:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-07 18:25 [PATCH 2/2] lib: vsprintf.c remove macros defining strict string functions Harvey Harrison
2008-05-07 20:09 ` Alexey Dobriyan
2008-05-07 19:20 ` Harvey Harrison [this message]
2008-05-07 19:24 ` Harvey Harrison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1210188046.19279.42.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox