Re: [PATCH v1 1/1] gpio: sim: Initialize attribute allocated on the heap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 8, 2021 at 6:24 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> The attributes on the heap must be initialized before use.
> Neglecting that will produce an Oops in some configurations:
>
>   BUG: key ffff000800eba398 has not been registered!
>
> Initialize attribute allocated on the heap.
>
> Fixes: 3f0279eb9e37 ("gpio: sim: new testing module")
> Reported-by: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx>
> Tested-by: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpio/gpio-sim.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> index ea17289a869c..92493b98c51b 100644
> --- a/drivers/gpio/gpio-sim.c
> +++ b/drivers/gpio/gpio-sim.c
> @@ -284,6 +284,7 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip)
>                 line_attr->offset = i;
>
>                 dev_attr = &line_attr->dev_attr;
> +               sysfs_attr_init(&dev_attr->attr);
>
>                 dev_attr->attr.name = devm_kasprintf(dev, GFP_KERNEL,
>                                                      "gpio%u", i);
> --
> 2.30.2
>

So writing tests really serves a purpose, heh? :)

Thanks for the patch and QA Andy and Naresh, patch applied.

Bartosz



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux