Article View: linux.kernel.netdev
Article #17722[PATCH net] cxgb4: allocate the full ethtool filter location array
From: Artemii Mashanov
Date: Tue, 17 Nov 2026 09:06
Date: Tue, 17 Nov 2026 09:06
38 lines
12255 bytes
12255 bytes
The ethtool filter location array stores nentries u32 values, but
cxgb4_init_ethtool_filters() passes nentries to kvzalloc() as a byte
count. The insertion and lookup paths allow indices below nentries,
which can address memory beyond the requested allocation.
Allocate nentries elements with kvcalloc() and the element size.
The array remains compatible with the existing kvfree() calls.
The size mismatch was found by reviewing the allocation, the array
declaration and the indexed accesses in the filter handlers.
Fixes: d915c299f1da ("cxgb4: add skeleton for ethtool n-tuple filters")
Signed-off-by: Artemii Mashanov <ralerrdirsardx@gmail.com>
---
Compile-tested cxgb4_ethtool.o with GCC 14.2 on x86-64 net/main
aa40afa831eb using W=1 and KCFLAGS=-Wno-error=format-truncation.
Both baseline and patched builds reported the same get_drvinfo()
format-truncation warning. Hardware validation is pending.
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
index 0092bc16f887..c72c0bcd45c8 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
@@ -2269,7 +2269,9 @@ int cxgb4_init_ethtool_filters(struct adapter *adap)
eth_filter->nentries = nentries;
for (i = 0; i < adap->params.nports; i++) {
- eth_filter->port[i].loc_array = kvzalloc(nentries, GFP_KERNEL);
+ eth_filter->port[i].loc_array =
+ kvcalloc(nentries, sizeof(*eth_filter->port[i].loc_array),
+ GFP_KERNEL);
if (!eth_filter->port[i].loc_array) {
ret = -ENOMEM;
goto free_eth_finfo;
Technical Details
Message-ID:
<20261117090608.33178-1-ralerrdirsardx@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365084-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365084-linux-kernel-netdev=dewy.ru
From: ralerrdirsardx@gmail.com (Artemii Mashanov)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] cxgb4: allocate the full ethtool filter location array
Date: Tue, 17 Nov 2026 12:06:08 +0300
Organization: Usenet Network
Message-ID: <20261117090608.33178-1-ralerrdirsardx@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2286641"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:I5vJyStc/j5N440j5Q2Q+uNb0o0= sha256:YcniU3YwjrE3bPWrpTgLtMp4maxpwSeiVTKinQsFIiI=
sha1:eymWteA8oGcvLIEnirhllrn3wUs= sha256:Jf6aLsayprDbiVbLlnDCa8eSYF7r/wm98igW4kRxVdY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id CFBCE114EB2; Tue, 17 Nov 2026 12:06:57 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id FUaGfKMNkRLe;
Tue, 17 Nov 2026 12:06:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-365084-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 868F1114EAB; Tue, 17 Nov 2026 12:06:42 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 3EF9B2C761; Tue, 17 Nov 2026 09:06:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794906397;
b=3Y49G+KoeZK3OPggyelhgEf23w01qwe0ZZY/sRThr34Zhs2EvxbFQFqcMJ6O6WyWRriF
lk0YUcIbK+eMK2tcZdRxiJpECi0dwBRcHweQLJgqp+v6vGcrQp2JFOQzh8+z0kCS6yVxn
qT61UdvwoqXYhj0/nBCdnnk7OJ8JhXQxdiX/Dg/R+NaWbS1rMyCCLB53ZAXtREWDFm8OC
+tkVDE33PFiNlWREcmZ4M1NrF+Hf7tyTB/0AYLpSsd8dRTT+1zQVS1egqMFfYbPAfQfvt
o0Zrsfffp6sGVplNXovRqGGj5digSIsxOIcIz7h3pKVIme8l0di0OgWegHb9uM8lUXQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794906397;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
bh=gLQ5AUW4d2+qMZuC/oCY4fCyjAhl4GpJFl1CEuDTSqc=;
b=s1LgEwygQFp6vveb0zMjGpQ98inWuGzxmhZA083pkBMmeOFkaeQk6IEiR7MqH2aU4Wcl
eZHyFzVR7M0ISBS4Sa4srqQJFttdQQ6b/HVL5FXed5f69hiHY4fVwO7HKIITS1h+D/ahR
KzJjKSC3iYFyi2wBEuwWfeMq9XHcSsXCJNRh7VrSOnrf+co9SlgX5JIc/MpWNRfk0gpC3
83V2m2Yvr5vSIXwkkpJesxPTB7F+Pqi56KCzJc7sRSlgcusYJIjWmzfHBFKppwnMvb3+r
CGThmSfC39mx0inp4WRdZLs06eFDSwFNX19rts5vtuTm3XJnQR6iMiAcJkgL2dSo+2Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=gpou3kHx;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id AC15A606A886;
Tue, 17 Nov 2026 09:06:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=gpou3kHx
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.54
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794906396;
b=U/EchDHgNQWFc6w4MVITWKhfOHw/R1HtxVGDzWoUPf91YpdW7H5dAg/cw6OGLBiYynFy
BS0Rm123FzUmjeHoND/Ckig6ad2I4Fdk5zjiDv8cYMaiy55wEEmlrvpatA/Vdv9gcXHqF
P+qFpYK3IeENDeq44bkJWfPsT8oqjNYcIpT4+h/oMiOeeRNbS65HT5+Dh6v0UyL0TwDv8
B4tYEXhihMI+tTh91oF7IPe3cAYNJV5U2Ro+04RhAxZGOELQp42rizuAVAG2Tl1ntVdhK
FZGBKKmGK/YptlH9WiJjRYfyvacGuXYzVfhStFKMn1GIZ/hv98L1EufDXD7YMeilTtQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794906396;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding;
bh=gLQ5AUW4d2+qMZuC/oCY4fCyjAhl4GpJFl1CEuDTSqc=;
b=ZZ+x+V0xsbOycG65u2H6kqr8LXZ9TpGX9+/LQ2k9Ty5exk66K8YuLgpvZ57RlQ0OmpVz
wOIqxW5w7x2fqNkc98q+E47CDn3rUEfv26jIftKcqF4Ri6efv+iIXBGSA3qmsoQr3ql/i
9RgQbFFSoCLoh8O26vpMgiiTBZcCfHKqUWJjZenh5fd7AYgj4j6gUiyJp4a2zvfNt0Itx
C0MeX4+/n5yIm/sWrsIIuQm+bOP8O7jE5BEnKG+to59vmUn5nYZbLCBtrNCvN6nQFvQg0
wI59EFkU37SCf0W/j+5MAXHR/MHqXcfog+mEGkEIBiNwJ25wLqlZjmIFuFK1LE06X8w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=gpou3kHx;
arc=none smtp.remote-ip=209.85.167.54
X-Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E0BE606A323
for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 09:06:36 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7E0BE606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5c1479be604so418343e87.1
for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 01:06:36 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794906395; x=1795511195; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=gLQ5AUW4d2+qMZuC/oCY4fCyjAhl4GpJFl1CEuDTSqc=;
b=gpou3kHx8sl52PrRVh6G70qelRKOciw83vO6keQtXSY5YGcWyqkFlKdM+X8YRaNlrm
isYb64ZeexlQHKMakQUOPrJnHI+3tF1i72m2GgFscgrddcHh1HmmAZyX3569K5hMqKjs
b/SMuvXMNvON3YVUoVjHzI9kp1ZeCCRQeYJU4vT3F7msiWgcV4+Z4SOkM0HlpDkOxdUA
fyLljN5cFdMoZajNazuoBDzMTR17q0dIgpe71YYsLCejd+JzPLX5NLO5YAx7xjfCDM2c
bW8KUqBe3UAoQqwy9k+jfZ2vNeWnZoH9J/6YBfRWuzs6eqaNVo5FPAt6YyS5s3kcMu3X
zvNQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794906395; x=1795511195;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=gLQ5AUW4d2+qMZuC/oCY4fCyjAhl4GpJFl1CEuDTSqc=;
b=nX08LXF5vvqaQjYT6KfCrjinbMCWrVyE28uSAnUnq7zjxt3Cy47aXmAbSqI91U5GJo
4F9/0pSYrewIGk6pyJQzDVf07E9A9a6ipJkOeCryUyWuWIrKb5fEEf79oVFWye1qHWh+
dfLry6hVWDKhP0xk55L90wOlfNKQPf217jBfuL7tEbNLNmfKkJDt6YnZPd0NsmEnhSm3
GuoNHTTbudE/Lh7AfF0SR7oUD3Rkm16PmIPIvPwyo9okm9ncX/UO2csPR23wRLj65WnM
6WQNqCLgi8zEMlS3LEGtleWSI0eCIQcu1PiZq2zvk0a8Vg6xB5Zpjp1m5jWsg2M6EBrp
9HPw==
X-Gm-Message-State: APuU4Z/uW603WK6jVISCn92AhHEPn7xq0yiDfHUlN/WRjWLmGklnd88b
082eAX23s4YjA/KBYf5ot4R6ILk72fTc4/92ikB/VlkGn80EzbuRTOWuTthRRt0T
X-Gm-Gg: AYBFou2Q+PEaUezSoDMcULwN0vxl6XNGNNxj0ofId3CEzT1ea5i6LrVf4z4Oq751TYv
uLkk1feRHqc0GnWyvCURpqZu+UrN2lnzrZMEVSIibPl0j/Q7lo9UbqFXvzqEgd8M4v3fgvhUcNs
N1f581MTcjObqcquLBPcwWxkwZ/6amiHQUbmgmbHl6CXWedEJ4nmI6J4USsHDMINVkyLnBnoflc
31m3hmBjxg7TR1klqJo4P8peBZiwxbqZcgD6m4I5dlK5SUmHgEKk99ON4szbLzge5COEjFl5pQy
ivvkmxlr2dIU8+DaZlivNPswbcwnPAEJWazETNd8i2NuSlWaDA/2wEuYQQ7YvYmVCbUbCjjzp1+
mefPZxGGJz7/IgZUD8uQPDOb8tjSQ9OhicFejA1MlvEhFSUkaudeicJ+FktNbBJSkW6OPBnfR6p
UjkZJFtG+VjhbqMeqsVCvfZvv/KJKQIyjxaC5UVDJy+UFNWFkhFE3CJAeuTZA5ict14KUcknuRI
11Yb6AjZPUB68bVudzk+ISKtEour8Gnl9ou1cnklCoXd8C7YN7R7ZTDoqPOc33MB0miCO8SbzaA
+v8oF3RxB6IwSFzn7Y/rYuB6JAD7+g/XfZyGzuafs9H5sd1SHySLIXU0j8EpZ0YmUKEfrBdpfoQ
xCoj+mNdCGUba3fon/h0nzCKeMhKPmjL0QD/OEBtUiCrRjFDZXw3WqX3hZPY=
X-Received: by 2002:a05:6512:31c9:b0:5c0:d102:8374 with SMTP id 2adb3069b0e04-5c1707804d6mr5128839e87.17.1794906394286;
Tue, 17 Nov 2026 01:06:34 -0800 (PST)
X-Received: from qblck ([188.130.155.185])
by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5c1713509f0sm3805043e87.63.2026.11.17.01.06.32
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 17 Nov 2026 01:06:33 -0800 (PST)
X-Cc: bharat@chelsio.com,
andrew+netdev@lunn.ch,
davem@davemloft.net,
edumazet@kernel.org,
kuba@kernel.org,
pabeni@redhat.com,
linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.56.0
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list