summaryrefslogtreecommitdiffstats
path: root/drivers/net/hamradio/dmascc.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-07-26 09:55:33 +0200
committerDavid S. Miller <davem@davemloft.net>2017-07-26 18:32:44 +0200
commit9877e1058aaf166b578ed44c8e0fc78fe6e67152 (patch)
treee05433e6e3bbc6a8d744bdc1cf14125d917ac38b /drivers/net/hamradio/dmascc.c
parentvirtio-net: mark PM functions as __maybe_unused (diff)
downloadlinux-9877e1058aaf166b578ed44c8e0fc78fe6e67152.tar.xz
linux-9877e1058aaf166b578ed44c8e0fc78fe6e67152.zip
hamradio: dmascc: avoid -Wformat-overflow warning
gcc warns that the device name might overflow: drivers/net/hamradio/dmascc.c: In function 'dmascc_init': drivers/net/hamradio/dmascc.c:584:22: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=] sprintf(dev->name, "dmascc%i", 2 * n + i); drivers/net/hamradio/dmascc.c:584:3: note: 'sprintf' output between 8 and 17 bytes into a destination of size 16 sprintf(dev->name, "dmascc%i", 2 * n + i); >From the static data in this file, I can tell that the index is strictly limited to 16, so it won't overflow. This simply changes the sprintf() to snprintf(), which is a good idea in general, and shuts up this warning. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hamradio/dmascc.c')
-rw-r--r--drivers/net/hamradio/dmascc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index dec6b76bc0fb..cde41200f40a 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -581,7 +581,7 @@ static int __init setup_adapter(int card_base, int type, int n)
priv->param.dma = -1;
INIT_WORK(&priv->rx_work, rx_bh);
dev->ml_priv = priv;
- sprintf(dev->name, "dmascc%i", 2 * n + i);
+ snprintf(dev->name, sizeof(dev->name), "dmascc%i", 2 * n + i);
dev->base_addr = card_base;
dev->irq = irq;
dev->netdev_ops = &scc_netdev_ops;