diff options
author | Arnd Bergmann <arnd@arndb.de> | 2017-07-14 08:07:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-14 12:03:11 -0400 |
commit | c7673e4dea9a338e00fa26cdd42d3697e8e22319 (patch) | |
tree | 39d1a2e6d672943189e467a13c44019032097b64 /drivers/net/vmxnet3 | |
parent | c41626ce3113eb2d40b5aa1c4fc2b0cd2785367b (diff) |
vmxnet3: avoid format strint overflow warning
gcc-7 notices that "-event-%d" could be more than 11 characters long
if we had larger 'vector' numbers:
drivers/net/vmxnet3/vmxnet3_drv.c: In function 'vmxnet3_activate_dev':
drivers/net/vmxnet3/vmxnet3_drv.c:2095:40: error: 'sprintf' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
sprintf(intr->event_msi_vector_name, "%s-event-%d",
^~~~~~~~~~~~~
drivers/net/vmxnet3/vmxnet3_drv.c:2095:3: note: 'sprintf' output between 9 and 33 bytes into a destination of size 32
The current code is safe, but making the string a little longer
is harmless and lets gcc see that it's ok.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vmxnet3')
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_int.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index ba1c9f93592b..9c51b8be0038 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -311,7 +311,7 @@ struct vmxnet3_intr { | |||
311 | u8 num_intrs; /* # of intr vectors */ | 311 | u8 num_intrs; /* # of intr vectors */ |
312 | u8 event_intr_idx; /* idx of the intr vector for event */ | 312 | u8 event_intr_idx; /* idx of the intr vector for event */ |
313 | u8 mod_levels[VMXNET3_LINUX_MAX_MSIX_VECT]; /* moderation level */ | 313 | u8 mod_levels[VMXNET3_LINUX_MAX_MSIX_VECT]; /* moderation level */ |
314 | char event_msi_vector_name[IFNAMSIZ+11]; | 314 | char event_msi_vector_name[IFNAMSIZ+17]; |
315 | #ifdef CONFIG_PCI_MSI | 315 | #ifdef CONFIG_PCI_MSI |
316 | struct msix_entry msix_entries[VMXNET3_LINUX_MAX_MSIX_VECT]; | 316 | struct msix_entry msix_entries[VMXNET3_LINUX_MAX_MSIX_VECT]; |
317 | #endif | 317 | #endif |