From: Rosen Penev <rosenp@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-gpio@vger.kernel.org, "Enrico Weigelt,
metux IT consult" <info@metux.net>,
Viresh Kumar <vireshk@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
"open list:VIRTIO GPIO DRIVER" <virtualization@lists.linux.dev>,
open list <linux-kernel@vger.kernel.org>,
"open list:KERNEL HARDENING (not covered by other
areas):Keyword:b__counted_by(_le|_be)?b"
<linux-hardening@vger.kernel.org>
Subject: Re: [PATCHv3] gpio: virtio: remove one kcalloc
Date: Thu, 12 Mar 2026 23:29:58 -0700 [thread overview]
Message-ID: <CAKxU2N_7sZu+J46sCQH4jgVB0r9HsHREToeCTg0Hz4PaVjY+sQ@mail.gmail.com> (raw)
In-Reply-To: <7jwgbrijeldghk44tdg2be5q7o7vuj5np3nlbl2pxuln6c7ll7@ntuquxxdnfmm>
On Thu, Mar 12, 2026 at 11:09 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 12-03-26, 12:37, Rosen Penev wrote:
> > A flexible array member can be used to combine allocations.
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> > v3: add counting field for __counted_by.
> > v2: add space in struct
> > drivers/gpio/gpio-virtio.c | 14 +++++++-------
> > 1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-virtio.c b/drivers/gpio/gpio-virtio.c
> > index ed6e0e90fa8a..57d0eb532c3c 100644
> > --- a/drivers/gpio/gpio-virtio.c
> > +++ b/drivers/gpio/gpio-virtio.c
> > @@ -52,7 +52,6 @@ struct virtio_gpio {
> > struct virtio_device *vdev;
> > struct mutex lock; /* Protects virtqueue operation */
> > struct gpio_chip gc;
> > - struct virtio_gpio_line *lines;
> > struct virtqueue *request_vq;
> >
> > /* irq support */
> > @@ -60,6 +59,9 @@ struct virtio_gpio {
> > struct mutex irq_lock; /* Protects irq operation */
> > raw_spinlock_t eventq_lock; /* Protects queuing of the buffer */
> > struct vgpio_irq_line *irq_lines;
> > +
> > + u16 ngpio;
> > + struct virtio_gpio_line lines[] __counted_by(ngpio);
> > };
>
> I wonder if it is worth it anymore. Why combining allocations is better when we
> are ending up using more memory ?
No idea. That's what maintainers suggested for some unknown reason.
Anyway, I don't care if this gets merged anymore.
>
> --
> viresh
next prev parent reply other threads:[~2026-03-13 6:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 19:37 [PATCHv3] gpio: virtio: remove one kcalloc Rosen Penev
2026-03-13 6:09 ` Viresh Kumar
2026-03-13 6:29 ` Rosen Penev [this message]
2026-03-16 14:08 ` Linus Walleij
2026-03-16 14:00 ` Linus Walleij
2026-03-17 8:48 ` Viresh Kumar
2026-03-17 9:45 ` Linus Walleij
2026-03-16 13:59 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKxU2N_7sZu+J46sCQH4jgVB0r9HsHREToeCTg0Hz4PaVjY+sQ@mail.gmail.com \
--to=rosenp@gmail.com \
--cc=brgl@kernel.org \
--cc=gustavoars@kernel.org \
--cc=info@metux.net \
--cc=kees@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=vireshk@kernel.org \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox