aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/neterion
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-01-19 14:34:51 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-19 19:42:21 -0500
commita8c1d28ac3925b99b5a939617d3fef1644298ee8 (patch)
treef068125515f1490894aa9313d0078895db84d0b1 /drivers/net/ethernet/neterion
parentef5a1ba145b95aafab823f833ad9b77d2ccc39bf (diff)
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)
6987 if (sp->s2io_entries[i].in_use == MSIX_FLG) { 6987 if (sp->s2io_entries[i].in_use == MSIX_FLG) {
6988 if (sp->s2io_entries[i].type == 6988 if (sp->s2io_entries[i].type ==
6989 MSIX_RING_TYPE) { 6989 MSIX_RING_TYPE) {
6990 sprintf(sp->desc[i], "%s:MSI-X-%d-RX", 6990 snprintf(sp->desc[i],
6991 sizeof(sp->desc[i]),
6992 "%s:MSI-X-%d-RX",
6991 dev->name, i); 6993 dev->name, i);
6992 err = request_irq(sp->entries[i].vector, 6994 err = request_irq(sp->entries[i].vector,
6993 s2io_msix_ring_handle, 6995 s2io_msix_ring_handle,
@@ -6996,7 +6998,9 @@ static int s2io_add_isr(struct s2io_nic *sp)
6996 sp->s2io_entries[i].arg); 6998 sp->s2io_entries[i].arg);
6997 } else if (sp->s2io_entries[i].type == 6999 } else if (sp->s2io_entries[i].type ==
6998 MSIX_ALARM_TYPE) { 7000 MSIX_ALARM_TYPE) {
6999 sprintf(sp->desc[i], "%s:MSI-X-%d-TX", 7001 snprintf(sp->desc[i],
7002 sizeof(sp->desc[i]),
7003 "%s:MSI-X-%d-TX",
7000 dev->name, i); 7004 dev->name, i);
7001 err = request_irq(sp->entries[i].vector, 7005 err = request_irq(sp->entries[i].vector,
7002 s2io_msix_fifo_handle, 7006 s2io_msix_fifo_handle,
@@ -8154,7 +8158,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
8154 "%s: UDP Fragmentation Offload(UFO) enabled\n", 8158 "%s: UDP Fragmentation Offload(UFO) enabled\n",
8155 dev->name); 8159 dev->name);
8156 /* Initialize device name */ 8160 /* Initialize device name */
8157 sprintf(sp->name, "%s Neterion %s", dev->name, sp->product_name); 8161 snprintf(sp->name, sizeof(sp->name), "%s Neterion %s", dev->name,
8162 sp->product_name);
8158 8163
8159 if (vlan_tag_strip) 8164 if (vlan_tag_strip)
8160 sp->vlan_strip_flag = 1; 8165 sp->vlan_strip_flag = 1;