summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/neterion
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-01-19 22:34:51 +0300
committerDavid S. Miller <davem@davemloft.net>2015-01-19 19:42:21 -0500
commita8c1d28ac3925b99b5a939617d3fef1644298ee8 (patch)
treef068125515f1490894aa9313d0078895db84d0b1 /drivers/net/ethernet/neterion
parentef5a1ba145b95aafab823f833ad9b77d2ccc39bf (diff)
downloadlinux-a8c1d28ac3925b99b5a939617d3fef1644298ee8.tar.gz
linux-a8c1d28ac3925b99b5a939617d3fef1644298ee8.tar.bz2
linux-a8c1d28ac3925b99b5a939617d3fef1644298ee8.zip
s2io: use snprintf() as a safety feature
"sp->desc[i]" has 25 characters. "dev->name" has 15 characters. If we used all 15 characters then the sprintf() would overflow. I changed the "sprintf(sp->name, "%s Neterion %s"" to snprintf(), as well, even though it can't overflow just to be consistent. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/neterion')
-rw-r--r--drivers/net/ethernet/neterion/s2io.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
index f5e4b820128b..db0c7a9aee60 100644
--- a/drivers/net/ethernet/neterion/s2io.c
+++ b/drivers/net/ethernet/neterion/s2io.c
@@ -6987,7 +6987,9 @@ static int s2io_add_isr(struct s2io_nic *sp)
if (sp->s2io_entries[i].in_use == MSIX_FLG) {
if (sp->s2io_entries[i].type ==
MSIX_RING_TYPE) {
- sprintf(sp->desc[i], "%s:MSI-X-%d-RX",
+ snprintf(sp->desc[i],
+ sizeof(sp->desc[i]),
+ "%s:MSI-X-%d-RX",
dev->name, i);
err = request_irq(sp->entries[i].vector,
s2io_msix_ring_handle,
@@ -6996,7 +6998,9 @@ static int s2io_add_isr(struct s2io_nic *sp)
sp->s2io_entries[i].arg);
} else if (sp->s2io_entries[i].type ==
MSIX_ALARM_TYPE) {
- sprintf(sp->desc[i], "%s:MSI-X-%d-TX",
+ snprintf(sp->desc[i],
+ sizeof(sp->desc[i]),
+ "%s:MSI-X-%d-TX",
dev->name, i);
err = request_irq(sp->entries[i].vector,
s2io_msix_fifo_handle,
@@ -8154,7 +8158,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
"%s: UDP Fragmentation Offload(UFO) enabled\n",
dev->name);
/* Initialize device name */
- sprintf(sp->name, "%s Neterion %s", dev->name, sp->product_name);
+ snprintf(sp->name, sizeof(sp->name), "%s Neterion %s", dev->name,
+ sp->product_name);
if (vlan_tag_strip)
sp->vlan_strip_flag = 1;