[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231123144735.GB1354538@google.com>
Date: Thu, 23 Nov 2023 14:47:35 +0000
From: Lee Jones <lee@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
Pavel Machek <pavel@....cz>
Subject: Re: [PATCH v1 2/4] leds: trigger: gpio: Convert to use kstrtox()
On Thu, 23 Nov 2023, Andy Shevchenko wrote:
> On Thu, Nov 23, 2023 at 11:05:38AM +0000, Lee Jones wrote:
> > On Fri, 03 Nov 2023, Andy Shevchenko wrote:
>
> ...
>
> > > - ret = sscanf(buf, "%u", &desired_brightness);
>
> "%u" (see man sscanf() for the details)
>
> ...
>
> > > + ret = kstrtou8(buf, 10, &desired_brightness);
> >
> > Where does 10 come from?
>
> See above.
Hmmm ...
I see that this is generally accepted. Although is looks like a recipe
for bugs to me. It's a shame we don't have something that can take a
variable, derives its type, then calculates the maximum length if
converted to a string.
Anyway, I'm probably babbling now ...
--
Lee Jones [李琼斯]
Powered by blists - more mailing lists