Thread (4 messages) 4 messages, 4 authors, 2026-02-26

Re: [PATCH] net: dsa: felix: use kmalloc_flex helper

From: Jijie Shao <shaojijie@huawei.com>
Date: 2026-02-25 09:13:37
Also in: lkml

on 2026/2/25 12:03, Rosen Penev wrote:
quoted hunk ↗ jump to hunk
A little simpler than using a separate size variable.

Signed-off-by: Rosen Penev <redacted>
---
  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;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help