From: Ethan Nelson-Moore <enelsonmoore@gmail.com>
To: netdev@vger.kernel.org
Cc: Ethan Nelson-Moore <enelsonmoore@gmail.com>,
Michael Grzeschik <m.grzeschik@pengutronix.de>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH 7/7] net: arcnet: com20020-pci: avoid -Wformat-truncation warning
Date: Sun, 17 May 2026 18:07:27 -0700 [thread overview]
Message-ID: <20260518010739.80979-8-enelsonmoore@gmail.com> (raw)
In-Reply-To: <20260518010739.80979-1-enelsonmoore@gmail.com>
When compiling the com20020-pci driver with W=1, I received the
following warning:
drivers/net/arcnet/com20020-pci.c:224:71: warning: ‘%d’ directive
output may be truncated writing between 1 and 11 bytes into a region of
size between 10 and 11 [-Wformat-truncation=]
224 | snprintf(dev->name, sizeof(dev->name), "arc%d-%d", dev->dev_id, i);
In reality, this does not represent a problem, because i is bounded by
the .devcount field in struct com20020_pci_card_info, which is
statically defined for each card and very small. Quiet the invalid
warning by changing the type of i and the .devcount field to be
narrower.
Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
---
drivers/net/arcnet/com20020-pci.c | 3 ++-
drivers/net/arcnet/com20020.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index 98f68cb13a52..f6b5371fcdcf 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -127,7 +127,8 @@ static int com20020pci_probe(struct pci_dev *pdev,
struct net_device *dev;
struct arcnet_local *lp;
struct com20020_priv *priv;
- int i, ioaddr, ret;
+ int ioaddr, ret;
+ u8 i;
struct resource *r;
ret = 0;
diff --git a/drivers/net/arcnet/com20020.h b/drivers/net/arcnet/com20020.h
index e7aac0e81a13..68f49fdc2c28 100644
--- a/drivers/net/arcnet/com20020.h
+++ b/drivers/net/arcnet/com20020.h
@@ -50,7 +50,7 @@ struct com20020_pci_channel_map {
struct com20020_pci_card_info {
const char *name;
- int devcount;
+ u8 devcount;
struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS];
struct com20020_pci_channel_map misc_map;
--
2.43.0
prev parent reply other threads:[~2026-05-18 1:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260518010739.80979-1-enelsonmoore@gmail.com>
2026-05-18 1:07 ` [PATCH RESEND 1/7] net: arcnet: com20020: remove misleading references to multicast Ethan Nelson-Moore
2026-05-19 1:32 ` [PATCH RESEND 0/7] ARCnet: remove outdated drivers and information and unused code; small cleanups and documentation improvements Ethan Nelson-Moore
2026-05-18 1:07 ` [PATCH RESEND 2/7] net: arcnet: fix typos in comments Ethan Nelson-Moore
2026-05-18 1:07 ` [PATCH RESEND 3/7] net: arcnet: remove code depending on nonexistent config option Ethan Nelson-Moore
2026-05-18 1:07 ` [PATCH 4/7] net: arcnet: expand unnecessary I/O abstraction macros Ethan Nelson-Moore
2026-05-19 1:22 ` Jakub Kicinski
2026-05-19 1:29 ` Ethan Nelson-Moore
2026-05-19 2:21 ` Ethan Nelson-Moore
2026-05-18 1:07 ` [PATCH 5/7] net: arcnet: remove ISA and PCMCIA support; modernize documentation Ethan Nelson-Moore
2026-05-18 1:07 ` [PATCH 6/7] docs: net: arcnet: remove outdated/irrelevant information; improve style Ethan Nelson-Moore
2026-05-18 1:07 ` Ethan Nelson-Moore [this message]
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=20260518010739.80979-8-enelsonmoore@gmail.com \
--to=enelsonmoore@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=m.grzeschik@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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