Thread (8 messages) 8 messages, 5 authors, 2026-03-10

Re: [PATCH] gpio: msc313: remove kcalloc

From: Bartosz Golaszewski <brgl@kernel.org>
Date: 2026-03-10 08:51:46
Also in: linux-gpio, linux-hardening, lkml

On Mon, Mar 9, 2026 at 11:00 PM Rosen Penev [off-list ref] wrote:
On Mon, Mar 9, 2026 at 2:03 AM Bartosz Golaszewski [off-list ref] wrote:
quoted
On Mon, Mar 9, 2026 at 2:27 AM Rosen Penev [off-list ref] wrote:
quoted
On Sun, Mar 8, 2026 at 5:06 PM Linus Walleij [off-list ref] wrote:
quoted
On Sun, Mar 8, 2026 at 3:15 AM Rosen Penev [off-list ref] wrote:
quoted
Use a flexible array member to combine kzalloc and kcalloc.

Signed-off-by: Rosen Penev <redacted>
(...)
quoted
 struct msc313_gpio {
        void __iomem *base;
        const struct msc313_gpio_data *gpio_data;
Do you wanna add:

const unsigned int saved_size;
So in the code there's

for (i = 0; i < gpio->gpio_data->num; i++)

which is equivalent to match->num.

__counted_by doesn't support pointers AFAIK.
quoted
This is a regular flexible array of u8. It should work fine with
__counted_by and I too am in favor of using it as it has become
standard for flexible arrays.
That requires adding an extra variable in the struct.
That's ok, it's negligible and provides tangible advantages.

Please do the same for your other patches.

Bart
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help