mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jijie Shao <shaojijie@huawei.com>
To: Rosen Penev <rosenp@gmail.com>, <netdev@vger.kernel.org>
Cc: <shaojijie@huawei.com>, Vladimir Oltean <vladimir.oltean@nxp.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	"maintainer:OCELOT ETHERNET SWITCH DRIVER"
	<UNGLinuxDriver@microchip.com>, Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: dsa: felix: use kmalloc_flex helper
Date: Wed, 25 Feb 2026 17:13:32 +0800	[thread overview]
Message-ID: <5191a479-fd32-4e64-b0b1-af013412b989@huawei.com> (raw)
In-Reply-To: <20260225040323.69497-1-rosenp@gmail.com>


on 2026/2/25 12:03, Rosen Penev wrote:
> A little simpler than using a separate size variable.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>   drivers/net/dsa/ocelot/felix_vsc9959.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
> index 8387dd208adb..cb132679fd99 100644
> --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
> +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
> @@ -2254,7 +2254,7 @@ static int vsc9959_psfp_filter_add(struct ocelot *ocelot, int port,
>   	struct felix_stream_gate *sgi;
>   	struct ocelot_psfp_list *psfp;
>   	struct ocelot_policer pol;
> -	int ret, i, size;
> +	int ret, i;
>   	u64 rate, burst;
>   	u32 index;
>   
> @@ -2271,8 +2271,7 @@ static int vsc9959_psfp_filter_add(struct ocelot *ocelot, int port,
>   	flow_action_for_each(i, a, &f->rule->action) {
>   		switch (a->id) {
>   		case FLOW_ACTION_GATE:
> -			size = struct_size(sgi, entries, a->gate.num_entries);
> -			sgi = kzalloc(size, GFP_KERNEL);
> +			sgi = kzalloc_flex(*sgi, entries, a->gate.num_entries, GFP_KERNEL);

Sorry, the subject is kmalloc_flex but code is kzalloc_flex

>   			if (!sgi) {
>   				ret = -ENOMEM;
>   				goto err;

  reply	other threads:[~2026-02-25  9:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25  4:03 Rosen Penev
2026-02-25  9:13 ` Jijie Shao [this message]
2026-02-26 12:23 ` Simon Horman
2026-02-26 13:03 ` Vladimir Oltean

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=5191a479-fd32-4e64-b0b1-af013412b989@huawei.com \
    --to=shaojijie@huawei.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rosenp@gmail.com \
    --cc=vladimir.oltean@nxp.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

all inboxes | Powered by JetHome®