lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXzU1k_JZ0UhUh33XCq_zpq6MBJgAjo9F9Cw4gckA12EQ@mail.gmail.com>
Date: Fri, 9 May 2025 11:07:47 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Thomas Richard <thomas.richard@...tlin.com>
Cc: Linus Walleij <linus.walleij@...aro.org>, 
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, Bartosz Golaszewski <brgl@...ev.pl>, 
	Kees Cook <kees@...nel.org>, Andy Shevchenko <andy@...nel.org>, linux-gpio@...r.kernel.org, 
	linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com, 
	DanieleCleri@...on.eu, GaryWang@...on.com.tw, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v5 08/12] gpio: aggregator: export symbols of the GPIO
 forwarder library

Hi Thomas,

On Tue, 6 May 2025 at 17:21, Thomas Richard <thomas.richard@...tlin.com> wrote:
> Export all symbols and create header file for the GPIO forwarder library.
> It will be used in the next changes.
>
> Signed-off-by: Thomas Richard <thomas.richard@...tlin.com>

Thanks for your patch!

> --- /dev/null
> +++ b/include/linux/gpio/forwarder.h
> @@ -0,0 +1,42 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __LINUX_GPIO_FORWARDER_H
> +#define __LINUX_GPIO_FORWARDER_H
> +
> +#include <linux/gpio/consumer.h>
> +#include <linux/gpio/driver.h>
> +
> +struct gpiochip_fwd;
> +
> +struct gpio_chip *gpio_fwd_get_gpiochip(struct gpiochip_fwd *fwd);
> +
> +int gpio_fwd_get_direction(struct gpio_chip *chip, unsigned int offset);
> +

Please drop empty lines between functions that belong together
logically.

> +int gpio_fwd_direction_input(struct gpio_chip *chip, unsigned int offset);
> +
> +int gpio_fwd_direction_output(struct gpio_chip *chip, unsigned int offset,
> +                             int value);
> +
> +int gpio_fwd_get(struct gpio_chip *chip, unsigned int offset);
> +
> +int gpio_fwd_get_multiple_locked(struct gpio_chip *chip, unsigned long *mask,
> +                                unsigned long *bits);
> +
> +int gpio_fwd_set(struct gpio_chip *chip, unsigned int offset, int value);
> +
> +int gpio_fwd_set_multiple_locked(struct gpio_chip *chip, unsigned long *mask,
> +                                unsigned long *bits);
> +
> +int gpio_fwd_set_config(struct gpio_chip *chip, unsigned int offset,
> +                       unsigned long config);
> +
> +int gpio_fwd_to_irq(struct gpio_chip *chip, unsigned int offset);

I would expect all of these to take gpiochip_fwd pointers instead of
gpio_chip pointers.  What prevents you from passing a gpio_chip pointer
that does not correspond to a gpiochip_fwd object, causing a crash?

> +
> +struct gpiochip_fwd *devm_gpio_fwd_alloc(struct device *dev,
> +                                        unsigned int ngpios);
> +
> +int gpio_fwd_gpio_add(struct gpiochip_fwd *fwd,
> +                     struct gpio_desc *desc, unsigned int offset);
> +
> +int gpio_fwd_register(struct gpiochip_fwd *fwd);

Please move these three to the top, as these functions are what the
user needs first, and drop the empty lines between them.

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ