From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 380873B992E for ; Mon, 20 Jul 2026 13:48:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784555340; cv=none; b=Lj6icmt36nAczKhz2iquMpf0FqAcrHEWwTzsa/442E9QgKr+SKHf6lsWhkDtP0Ar4+vmHUFPt+dmR160ZFYTD7n76J2MAcXDjl0iYfDiYXb0fiG3wAVDk8Q8VUwW/WD04Q9h0mFSIwbY685It/avqjiX9hTuHu2RsODdh03XvTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784555340; c=relaxed/simple; bh=sHKsOvktHornLe+ZeU8u/20dX6bNatlr37qX8toUr58=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=T6ucw/RkNpJZTIkR3+fBV9T7mN7DJuF3zn7quSO8lyg+6Is4Wi5+UV/lfAIqzcuztMrEOsIQzPu02W7gIHfMwcMcAo+8HCO249y8E5Ftm6LBcQP3y4/e1jkcAsAdqwfQph1WbTYybkZkGa/3//vo5DnJRa9CywEZxayNIcUeGqk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to; spf=none smtp.mailfrom=dama.to; dkim=pass (2048-bit key) header.d=dama-to.20251104.gappssmtp.com header.i=@dama-to.20251104.gappssmtp.com header.b=xC6+8zLl; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dama-to.20251104.gappssmtp.com header.i=@dama-to.20251104.gappssmtp.com header.b="xC6+8zLl" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-84a652535dcso3270861b3a.3 for ; Mon, 20 Jul 2026 06:48:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20251104.gappssmtp.com; s=20251104; t=1784555334; x=1785160134; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=exgSZUy4mQ+gBayEGCoSCzUgfoiRVrcGM1wITQ8aelo=; b=xC6+8zLl7S7krs4wKiFhDBEIIGvkvZsRjZ072BSOldbfflGkE2NGRVx5dlPl52to+n ouLVNs1J945DC/anYL1rhXOhdP5rPzPljJdEF4H7LYEhOqFBNsr/lwNJ6CnXfNNcCobd 2sGzX7XIoLXNuw4rmmCqO2CFCqb6SqYgreIo1/4KSrxDWy5tHINhtSKcgdUn6c6s0CNy bC8JQHUsjFOHTX+kakFeAGDbr1gukkybITiyFXmML15h2eMBIkzLjoeZGh0JoYrtA4iy 0FuXRJpS1hsJ0kHWM24Tz8xJPtEgmeQ0Ej1I6X8Om1qYXBRHL2ZuEEQ0S+YFP+iTreWj aaOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784555334; x=1785160134; h=in-reply-to:content-disposition:content-type:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=exgSZUy4mQ+gBayEGCoSCzUgfoiRVrcGM1wITQ8aelo=; b=TrlqsbVzcEcvFJ1Y9qWkj6/9JXYAzz7jNO3GXZP308Gq/yDZAbSUxhR+hvps7G8REV KaMleAxuuz7n1SHBaWNf4d7e6lZ+Kc8e6X3yfTLhf83JWD+oSfj4ZpY0qfTERjb1t5U2 +xwkJC0fTExs4YP9fdc9lZB07vQVSUvwYSzH4hzJaROZbcWFFLE/Aqf0LPA3zd7Qf4Zc wr5SjuYn8AiRZj2S5Z2luZdFh0J13KmyI5VRFjkdil60ANsDwsGjpGTmlrvv6mkFfl4r AvU/CtXesDJd9S+Y3aPeXxKoYX2VTPy+SeofCUfmuVq4Thyj8wI44bDtrWAAlVfNZWEv 3ONw== X-Forwarded-Encrypted: i=1; AHgh+RpKKQnVGVH9g6E/Wp9i84fBb9aneb8TUOj2Fyhf0bMFryoneIb4DrDCWOZ7zTUpM1p+rRxvSwMZ3nvf4Q0=@vger.kernel.org X-Gm-Message-State: AOJu0Ywsqbbcbpy1iPO0CyScWMLOQwuRpVii/wX9HsJtYZDPLF950oar 5HjFd/YyAX3rd7qHXBzI4lVNYmE2YoW5ew9rSbb0uYbe16p7aRXWly3LfdgaPSchlo8= X-Gm-Gg: AfdE7cl42JZ8yOAosjlL7Mg2TJ/DhsFkyFzIz7iT4mn/SPrIZdLYMCKGmfwQaSZXcAL d9E6tUM7Oiv1XG8u6IKcVa2a95lacbND3qUWE4X/Wn6hrA0s+8K7V2c81B7pFQ5UgNuOGKMX0aU q70xCWduTIwZrGC9LTeF34QjSm83cOdS07zBWka2Ln9k5Omb5OL4S/ATFSAZVJwmkA2Iy2QubdL bN3EsbKN1G3yVDHUe76KPdC5/hJIjmpS6otSUIr1smc1//eQUCGYrpOJYTsyb+3+H2W5kauoKI5 y96yO1mkggK9jwNgEeLH/wZxA9QCgjfEAA8GIZ1Bk/xlmqRsWo3QNerYhAI614zRaJRzIXWLvpI ktCZ0+W/Ih1rmluLcC/thSUbW/1iY4RiYbXw+84sDzfAXAw3SUufZ3YM= X-Received: by 2002:a05:6a00:998:b0:845:eb73:411c with SMTP id d2e1a72fcca58-84c2946f027mr14586475b3a.45.1784555334640; Mon, 20 Jul 2026 06:48:54 -0700 (PDT) Received: from localhost ([2a03:2880:2ff::]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84c2adc3466sm5844378b3a.15.2026.07.20.06.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 06:48:53 -0700 (PDT) Date: Mon, 20 Jul 2026 06:48:53 -0700 From: Joe Damato To: wei.fang@oss.nxp.com Cc: claudiu.manoil@nxp.com, vladimir.oltean@nxp.com, xiaoning.wang@nxp.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, wei.fang@nxp.com, chleroy@kernel.org, maxime.chevallier@bootlin.com, imx@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH RESEND v4 net-next 14/14] net: enetc: use kzalloc_flex() for enetc_psfp_gate allocation Message-ID: Mail-Followup-To: Joe Damato , wei.fang@oss.nxp.com, claudiu.manoil@nxp.com, vladimir.oltean@nxp.com, xiaoning.wang@nxp.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, wei.fang@nxp.com, chleroy@kernel.org, maxime.chevallier@bootlin.com, imx@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org References: <20260720014317.1059359-1-wei.fang@oss.nxp.com> <20260720014317.1059359-15-wei.fang@oss.nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260720014317.1059359-15-wei.fang@oss.nxp.com> On Mon, Jul 20, 2026 at 09:43:16AM +0800, wei.fang@oss.nxp.com wrote: > From: Wei Fang > > Replace the open-coded struct_size() + kzalloc() pattern with the > kzalloc_flex() helper when allocating struct enetc_psfp_gate. This > removes the intermediate entries_size local variable and makes the > allocation site more concise. > > Signed-off-by: Wei Fang > --- > drivers/net/ethernet/freescale/enetc/enetc_qos.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c > index 7b17bca24f26..2aa0fcaafcd2 100644 > --- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c > +++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c > @@ -1135,7 +1135,6 @@ static int enetc_psfp_parse_clsflower(struct enetc_ndev_priv *priv, > struct flow_action_entry *entry; > struct action_gate_entry *e; > u8 sfi_overwrite = 0; > - int entries_size; > int i, err; > > if (f->common.chain_index >= priv->psfp_cap.max_streamid) { > @@ -1242,8 +1241,7 @@ static int enetc_psfp_parse_clsflower(struct enetc_ndev_priv *priv, > goto free_filter; > } > > - entries_size = struct_size(sgi, entries, entryg->gate.num_entries); > - sgi = kzalloc(entries_size, GFP_KERNEL); > + sgi = kzalloc_flex(*sgi, entries, entryg->gate.num_entries); > if (!sgi) { > err = -ENOMEM; > goto free_filter; Reviewed-by: Joe Damato