From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>,
netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.4 25/63] e1000e: Fix -Wformat-truncation warnings
Date: Wed, 27 Mar 2019 14:22:45 -0400 [thread overview]
Message-ID: <20190327182323.18577-25-sashal@kernel.org> (raw)
In-Reply-To: <20190327182323.18577-1-sashal@kernel.org>
From: Florian Fainelli <f.fainelli@gmail.com>
[ Upstream commit 135e7245479addc6b1f5d031e3d7e2ddb3d2b109 ]
Provide precision hints to snprintf() since we know the destination
buffer size of the RX/TX ring names are IFNAMSIZ + 5 - 1. This fixes the
following warnings:
drivers/net/ethernet/intel/e1000e/netdev.c: In function
'e1000_request_msix':
drivers/net/ethernet/intel/e1000e/netdev.c:2109:13: warning: 'snprintf'
output may be truncated before the last format character
[-Wformat-truncation=]
"%s-rx-0", netdev->name);
^
drivers/net/ethernet/intel/e1000e/netdev.c:2107:3: note: 'snprintf'
output between 6 and 21 bytes into a destination of size 20
snprintf(adapter->rx_ring->name,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sizeof(adapter->rx_ring->name) - 1,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%s-rx-0", netdev->name);
~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/e1000e/netdev.c:2125:13: warning: 'snprintf'
output may be truncated before the last format character
[-Wformat-truncation=]
"%s-tx-0", netdev->name);
^
drivers/net/ethernet/intel/e1000e/netdev.c:2123:3: note: 'snprintf'
output between 6 and 21 bytes into a destination of size 20
snprintf(adapter->tx_ring->name,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sizeof(adapter->tx_ring->name) - 1,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%s-tx-0", netdev->name);
~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 6369d88b81c1..6b1cacd86c6e 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -2131,7 +2131,7 @@ static int e1000_request_msix(struct e1000_adapter *adapter)
if (strlen(netdev->name) < (IFNAMSIZ - 5))
snprintf(adapter->rx_ring->name,
sizeof(adapter->rx_ring->name) - 1,
- "%s-rx-0", netdev->name);
+ "%.14s-rx-0", netdev->name);
else
memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ);
err = request_irq(adapter->msix_entries[vector].vector,
@@ -2147,7 +2147,7 @@ static int e1000_request_msix(struct e1000_adapter *adapter)
if (strlen(netdev->name) < (IFNAMSIZ - 5))
snprintf(adapter->tx_ring->name,
sizeof(adapter->tx_ring->name) - 1,
- "%s-tx-0", netdev->name);
+ "%.14s-tx-0", netdev->name);
else
memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ);
err = request_irq(adapter->msix_entries[vector].vector,
--
2.19.1
next prev parent reply other threads:[~2019-03-27 18:36 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-27 18:22 [PATCH AUTOSEL 4.4 01/63] CIFS: fix POSIX lock leak and invalid ptr deref Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 02/63] h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux- Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 03/63] i2c: sis630: correct format strings Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 04/63] tracing: kdb: Fix ftdump to not sleep Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 05/63] gpio: gpio-omap: fix level interrupt idling Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 06/63] sysctl: handle overflow for file-max Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 07/63] enic: fix build warning without CONFIG_CPUMASK_OFFSTACK Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 08/63] mm/cma.c: cma_declare_contiguous: correct err handling Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 09/63] mm/page_ext.c: fix an imbalance with kmemleak Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 10/63] mm/vmalloc.c: fix kernel BUG at mm/vmalloc.c:512! Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 11/63] mm/slab.c: kmemleak no scan alien caches Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 12/63] ocfs2: fix a panic problem caused by o2cb_ctl Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 13/63] f2fs: do not use mutex lock in atomic context Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 14/63] fs/file.c: initialize init_files.resize_wait Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 15/63] cifs: use correct format characters Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 16/63] dm thin: add sanity checks to thin-pool and external snapshot creation Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 17/63] cifs: Fix NULL pointer dereference of devname Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 18/63] fs: fix guard_bio_eod to check for real EOD errors Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 19/63] tools lib traceevent: Fix buffer overflow in arg_eval Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 20/63] usb: chipidea: Grab the (legacy) USB PHY by phandle first Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 21/63] scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 22/63] coresight: etm4x: Add support to enable ETMv4.2 Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 23/63] ARM: 8840/1: use a raw_spinlock_t in unwind Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 24/63] mmc: omap: fix the maximum timeout setting Sasha Levin
2019-03-27 18:22 ` Sasha Levin [this message]
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 26/63] IB/mlx4: Increase the timeout for CM cache Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 27/63] ASoC: qcom: Fix of-node refcount unbalance in apq8016_sbc_parse_of() Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 28/63] scsi: megaraid_sas: return error when create DMA pool failed Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 29/63] perf test: Fix failure of 'evsel-tp-sched' test on s390 Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 30/63] SoC: imx-sgtl5000: add missing put_device() Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 31/63] media: sh_veu: Correct return type for mem2mem buffer helpers Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 32/63] media: s5p-jpeg: " Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 33/63] media: s5p-g2d: " Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 34/63] media: mx2_emmaprp: " Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 35/63] leds: lp55xx: fix null deref on firmware load failure Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 36/63] kprobes: Prohibit probing on bsearch() Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 37/63] ARM: 8833/1: Ensure that NEON code always compiles with Clang Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 38/63] ALSA: PCM: check if ops are defined before suspending PCM Sasha Levin
2019-03-27 18:22 ` [PATCH AUTOSEL 4.4 39/63] bcache: fix input overflow to cache set sysfs file io_error_halflife Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 40/63] bcache: fix input overflow to sequential_cutoff Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 41/63] bcache: improve sysfs_strtoul_clamp() Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 42/63] fbdev: fbmem: fix memory access if logo is bigger than the screen Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 43/63] cdrom: Fix race condition in cdrom_sysctl_register Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 44/63] e1000e: fix cyclic resets at link up with active tx Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 45/63] ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 46/63] locking/lockdep: Add debug_locks check in __lock_downgrade() Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 47/63] soc: qcom: gsbi: Fix error handling in gsbi_probe() Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 48/63] mt7601u: bump supported EEPROM version Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 49/63] ARM: avoid Cortex-A9 livelock on tight dmb loops Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 50/63] tty: increase the default flip buffer limit to 2*640K Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 51/63] media: mt9m111: set initial frame size other than 0x0 Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 52/63] hwrng: virtio - Avoid repeated init of completion Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 53/63] soc/tegra: fuse: Fix illegal free of IO base address Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 54/63] Bluetooth: Verify that l2cap_get_conf_opt provides large enough buffer Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 55/63] hpet: Fix missing '=' character in the __setup() code of hpet_mmap_enable Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 56/63] dmaengine: imx-dma: fix warning comparison of distinct pointer types Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 57/63] netfilter: physdev: relax br_netfilter dependency Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 58/63] media: s5p-jpeg: Check for fmt_ver_flag when doing fmt enumeration Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 59/63] regulator: act8865: Fix act8600_sudcdc_voltage_ranges setting Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 60/63] wlcore: Fix memory leak in case wl12xx_fetch_firmware failure Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 61/63] x86/build: Mark per-CPU symbols as absolute explicitly for LLD Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 62/63] dmaengine: tegra: avoid overflow of byte tracking Sasha Levin
2019-03-27 18:23 ` [PATCH AUTOSEL 4.4 63/63] drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers Sasha Levin
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=20190327182323.18577-25-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).