From: Andi Shyti <andi.shyti@kernel.org>
To: Rosen Penev <rosenp@gmail.com>
Cc: linux-i2c@vger.kernel.org,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
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: [PATCH] i2c: atr: use kzalloc_flex
Date: Thu, 9 Apr 2026 18:29:22 +0200 [thread overview]
Message-ID: <adfTdfty7q0nygeo@zenone.zhora.eu> (raw)
In-Reply-To: <20260327030310.8502-1-rosenp@gmail.com>
Hi Rosen,
along with Luca's comments, I will ask you for one more change:
...
> /* Protects aliases and use_mask */
> spinlock_t lock;
> - u16 *aliases;
> unsigned long *use_mask;
> + u16 aliases[] __counted_by(size);
...
> - alias_pool = kzalloc_obj(*alias_pool);
> + alias_pool = kzalloc_flex(*alias_pool, aliases, num_aliases);
> if (!alias_pool)
> return ERR_PTR(-ENOMEM);
>
> alias_pool->size = num_aliases;
this line is not needed anymore because kzalloc_flex will resolve
to alias_pool size and will set it tu num_aliases.
We can remove it.
Thanks,
Andi
> - alias_pool->aliases = kcalloc(num_aliases, sizeof(*alias_pool->aliases), GFP_KERNEL);
> - if (!alias_pool->aliases) {
> - ret = -ENOMEM;
> - goto err_free_alias_pool;
> - }
> -
next prev parent reply other threads:[~2026-04-09 16:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 3:03 [PATCH] i2c: atr: use kzalloc_flex Rosen Penev
2026-03-27 8:12 ` Luca Ceresoli
2026-03-27 18:35 ` Rosen Penev
2026-04-09 16:29 ` Andi Shyti [this message]
2026-04-09 16:37 ` Rosen Penev
2026-04-09 23:22 ` Andi Shyti
-- strict thread matches above, loose matches on Subject: below --
2026-03-13 0:23 Rosen Penev
2026-03-13 8:17 ` Luca Ceresoli
2026-03-13 21:48 ` Rosen Penev
2026-03-30 8:50 ` Romain Gantois
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=adfTdfty7q0nygeo@zenone.zhora.eu \
--to=andi.shyti@kernel.org \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=rosenp@gmail.com \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=wsa+renesas@sang-engineering.com \
/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