[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdVVo4hPExXtLf9UpFvqxX6RF4RJKgO64JpRVWtwwgqZAg@mail.gmail.com>
Date: Mon, 14 Apr 2025 09:52:31 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Koichiro Den <koichiro.den@...onical.com>,
Geert Uytterhoeven <geert+renesas@...der.be>, Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>, linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/5] gpio: aggregator: fix "_sysfs" prefix check in gpio_aggregator_make_group()
Hi Dan,
On Sat, 12 Apr 2025 at 12:15, Dan Carpenter <dan.carpenter@...aro.org> wrote:
> This code is intended to reject strings that start with "_sysfs" but the
> strcmp() limit is wrong so checks the whole string instead of the prefix.
>
> Fixes: 83c8e3df642f ("gpio: aggregator: expose aggregator created via legacy sysfs to configfs")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>
> --- a/drivers/gpio/gpio-aggregator.c
> +++ b/drivers/gpio/gpio-aggregator.c
> @@ -1016,7 +1016,7 @@ gpio_aggregator_make_group(struct config_group *group, const char *name)
> * for devices create via legacy sysfs interface.
> */
> if (strncmp(name, AGGREGATOR_LEGACY_PREFIX,
> - sizeof(AGGREGATOR_LEGACY_PREFIX)) == 0)
> + sizeof(AGGREGATOR_LEGACY_PREFIX) - 1) == 0)
Or perhaps just strlen()? The compiler should optimize that to a constant, too.
> return ERR_PTR(-EINVAL);
>
> /* arg space is unneeded */
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists