Re: [PATCH 1/2] gpio: sim: fix an invalid __free() usage

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

 



On Fri, Sep 15, 2023 at 02:34:22PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> 
> gpio_sim_make_line_names() returns NULL or ERR_PTR() so we must not use
> __free(kfree) on the returned address. Let's rework the function so that
> it returns the size of the gpio-line-names array or a negative error
> code on failure. This way we know that the string array will either stay
> NULL or be set to a correct, kcalloc()'ed address.

...

> +	names = kcalloc(line_names_size, sizeof(*line_names), GFP_KERNEL);

sizeof(*line_names) is a bit unusual here. names is typed as double pointer,
while line_names as a tripple one.

-- 
With Best Regards,
Andy Shevchenko





[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