[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimeEKjVwwYi+twb0oeoFK-33LMx5aQBZEnPodne@mail.gmail.com>
Date: Wed, 23 Mar 2011 17:30:11 +0200
From: Alexey Dobriyan <adobriyan@...il.com>
To: Jonathan Cameron <jic23@....ac.uk>
Cc: linux-kernel@...r.kernel.org, greg@...ah.com, rusty@...tcorp.com.au
Subject: Re: [PATCH 1/3] Add a kstrtobool function matching semantics of
existing in kernel equivalents.
On Wed, Mar 23, 2011 at 3:39 PM, Jonathan Cameron <jic23@....ac.uk> wrote:
> +int kstrtobool(const char *s, bool *res)
> +{
> + switch (s[0]) {
> + case 'y':
> + case 'Y':
> + case '1':
> + *res = true;
> + case 'n':
> + case 'N':
> + case '0':
> + *res = false;
> + default:
> + return -EINVAL;
> + }
> + return 0;
> +}
sigh... such simple thing and so many bugs
The only values such function should accept is 0 and 1.
Have you read the rest of kstrto*() code?
Where is newline check?
Anyway, I think it's better do not exist.
--
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