netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] -Wformat fixes
@ 2019-02-22  4:09 Florian Fainelli
  2019-02-22  4:09 ` [PATCH net-next 1/4] mlxsw: spectrum: Avoid -Wformat-truncation warnings Florian Fainelli
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Florian Fainelli @ 2019-02-22  4:09 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli

Hi,

This is a collection of some -Wformat fixes found during build, nothing
critical, but nice to have for people turning on more warnings with
their builds.

Florian Fainelli (4):
  mlxsw: spectrum: Avoid -Wformat-truncation warnings
  net: dsa: mv88e6xxx: Fix -Wformat-security warnings
  e1000e: Fix -Wformat-truncation warnings
  veth: Fix -Wformat-truncation

 drivers/net/dsa/mv88e6xxx/chip.c               | 2 +-
 drivers/net/dsa/mv88e6xxx/ptp.c                | 2 +-
 drivers/net/ethernet/intel/e1000e/netdev.c     | 4 ++--
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 ++--
 drivers/net/veth.c                             | 3 ++-
 5 files changed, 8 insertions(+), 7 deletions(-)

-- 
2.19.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net-next 1/4] mlxsw: spectrum: Avoid -Wformat-truncation warnings
  2019-02-22  4:09 [PATCH net-next 0/4] -Wformat fixes Florian Fainelli
@ 2019-02-22  4:09 ` Florian Fainelli
  2019-02-22 13:25   ` Ido Schimmel
  2019-02-22  4:09 ` [PATCH net-next 2/4] net: dsa: mv88e6xxx: Fix -Wformat-security warnings Florian Fainelli
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2019-02-22  4:09 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli, Jiri Pirko, Ido Schimmel, open list

Give precision identifiers to the two snprintf() formatting the priority
and TC strings to avoid producing these two warnings:

drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function
'mlxsw_sp_port_get_prio_strings':
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2132:37: warning: '%d'
directive output may be truncated writing between 1 and 3 bytes into a
region of size between 0 and 31 [-Wformat-truncation=]
   snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
                                     ^~
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2132:3: note: 'snprintf'
output between 3 and 36 bytes into a destination of size 32
   snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     mlxsw_sp_port_hw_prio_stats[i].str, prio);
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function
'mlxsw_sp_port_get_tc_strings':
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2143:37: warning: '%d'
directive output may be truncated writing between 1 and 11 bytes into a
region of size between 0 and 31 [-Wformat-truncation=]
   snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
                                     ^~
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2143:3: note: 'snprintf'
output between 3 and 44 bytes into a destination of size 32
   snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     mlxsw_sp_port_hw_tc_stats[i].str, tc);
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index f018b0607dac..5f6962da8877 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -2129,7 +2129,7 @@ static void mlxsw_sp_port_get_prio_strings(u8 **p, int prio)
 	int i;
 
 	for (i = 0; i < MLXSW_SP_PORT_HW_PRIO_STATS_LEN; i++) {
-		snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
+		snprintf(*p, ETH_GSTRING_LEN, "%.29s_%.1d",
 			 mlxsw_sp_port_hw_prio_stats[i].str, prio);
 		*p += ETH_GSTRING_LEN;
 	}
@@ -2140,7 +2140,7 @@ static void mlxsw_sp_port_get_tc_strings(u8 **p, int tc)
 	int i;
 
 	for (i = 0; i < MLXSW_SP_PORT_HW_TC_STATS_LEN; i++) {
-		snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
+		snprintf(*p, ETH_GSTRING_LEN, "%.29s_%.1d",
 			 mlxsw_sp_port_hw_tc_stats[i].str, tc);
 		*p += ETH_GSTRING_LEN;
 	}
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 2/4] net: dsa: mv88e6xxx: Fix -Wformat-security warnings
  2019-02-22  4:09 [PATCH net-next 0/4] -Wformat fixes Florian Fainelli
  2019-02-22  4:09 ` [PATCH net-next 1/4] mlxsw: spectrum: Avoid -Wformat-truncation warnings Florian Fainelli
@ 2019-02-22  4:09 ` Florian Fainelli
  2019-02-22 13:14   ` Andrew Lunn
  2019-02-22  4:09 ` [PATCH net-next 3/4] e1000e: Fix -Wformat-truncation warnings Florian Fainelli
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2019-02-22  4:09 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli, Andrew Lunn, Vivien Didelot, open list

We are not specifying an explicit format argument but instead passing a
string litteral which causes these two warnings to show up:

drivers/net/dsa/mv88e6xxx/chip.c: In function
'mv88e6xxx_irq_poll_setup':
drivers/net/dsa/mv88e6xxx/chip.c:483:2: warning: format not a string
literal and no format arguments [-Wformat-security]
  chip->kworker = kthread_create_worker(0, dev_name(chip->dev));
  ^~~~
drivers/net/dsa/mv88e6xxx/ptp.c: In function 'mv88e6xxx_ptp_setup':
drivers/net/dsa/mv88e6xxx/ptp.c:403:4: warning: format not a string
literal and no format arguments [-Wformat-security]
    dev_name(chip->dev));
    ^~~~~~~~
  LD [M]  drivers/net/dsa/mv88e6xxx/mv88e6xxx.o

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
 drivers/net/dsa/mv88e6xxx/ptp.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index cc7ce06b6d58..3f9a3fc52a0e 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -480,7 +480,7 @@ static int mv88e6xxx_irq_poll_setup(struct mv88e6xxx_chip *chip)
 	kthread_init_delayed_work(&chip->irq_poll_work,
 				  mv88e6xxx_irq_poll);
 
-	chip->kworker = kthread_create_worker(0, dev_name(chip->dev));
+	chip->kworker = kthread_create_worker(0, "%s", dev_name(chip->dev));
 	if (IS_ERR(chip->kworker))
 		return PTR_ERR(chip->kworker);
 
diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
index 4b336d8d4c67..42872d21857b 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.c
+++ b/drivers/net/dsa/mv88e6xxx/ptp.c
@@ -400,7 +400,7 @@ int mv88e6xxx_ptp_setup(struct mv88e6xxx_chip *chip)
 
 	chip->ptp_clock_info.owner = THIS_MODULE;
 	snprintf(chip->ptp_clock_info.name, sizeof(chip->ptp_clock_info.name),
-		 dev_name(chip->dev));
+		 "%s", dev_name(chip->dev));
 	chip->ptp_clock_info.max_adj	= 1000000;
 
 	chip->ptp_clock_info.n_ext_ts	= ptp_ops->n_ext_ts;
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 3/4] e1000e: Fix -Wformat-truncation warnings
  2019-02-22  4:09 [PATCH net-next 0/4] -Wformat fixes Florian Fainelli
  2019-02-22  4:09 ` [PATCH net-next 1/4] mlxsw: spectrum: Avoid -Wformat-truncation warnings Florian Fainelli
  2019-02-22  4:09 ` [PATCH net-next 2/4] net: dsa: mv88e6xxx: Fix -Wformat-security warnings Florian Fainelli
@ 2019-02-22  4:09 ` Florian Fainelli
  2019-02-25 18:26   ` [Intel-wired-lan] " Neftin, Sasha
  2019-02-22  4:09 ` [PATCH net-next 4/4] veth: Fix -Wformat-truncation Florian Fainelli
  2019-02-23 21:45 ` [PATCH net-next 0/4] -Wformat fixes David Miller
  4 siblings, 1 reply; 9+ messages in thread
From: Florian Fainelli @ 2019-02-22  4:09 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Jeff Kirsher,
	moderated list:INTEL ETHERNET DRIVERS, open list

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>
---
 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 736fa51878f8..7acc61e4f645 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -2106,7 +2106,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,
@@ -2122,7 +2122,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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 4/4] veth: Fix -Wformat-truncation
  2019-02-22  4:09 [PATCH net-next 0/4] -Wformat fixes Florian Fainelli
                   ` (2 preceding siblings ...)
  2019-02-22  4:09 ` [PATCH net-next 3/4] e1000e: Fix -Wformat-truncation warnings Florian Fainelli
@ 2019-02-22  4:09 ` Florian Fainelli
  2019-02-23 21:45 ` [PATCH net-next 0/4] -Wformat fixes David Miller
  4 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2019-02-22  4:09 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Alexei Starovoitov, Daniel Borkmann,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
	Toshiaki Makita, David Ahern, Michael Walle, Li RongQing,
	open list, open list:XDP (eXpress Data Path)

Provide a precision hint to snprintf() in order to eliminate a
-Wformat-truncation warning provided below. A maximum of 11 characters
is allowed to reach a maximum of 32 - 1 characters given a possible
maximum value of queues using up to UINT_MAX which occupies 10
characters. Incidentally 11 is the number of characters for
"xdp_packets" which is the largest string we append.

drivers/net/veth.c: In function 'veth_get_strings':
drivers/net/veth.c:118:47: warning: '%s' directive output may be
truncated writing up to 31 bytes into a region of size between 12 and 21
[-Wformat-truncation=]
     snprintf(p, ETH_GSTRING_LEN, "rx_queue_%u_%s",
                                               ^~
drivers/net/veth.c:118:5: note: 'snprintf' output between 12 and 52
bytes into a destination of size 32
     snprintf(p, ETH_GSTRING_LEN, "rx_queue_%u_%s",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       i, veth_rq_stats_desc[j].desc);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/veth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index fbf890ebbeae..569e87a51a33 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -115,7 +115,8 @@ static void veth_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
 		p += sizeof(ethtool_stats_keys);
 		for (i = 0; i < dev->real_num_rx_queues; i++) {
 			for (j = 0; j < VETH_RQ_STATS_LEN; j++) {
-				snprintf(p, ETH_GSTRING_LEN, "rx_queue_%u_%s",
+				snprintf(p, ETH_GSTRING_LEN,
+					 "rx_queue_%u_%.11s",
 					 i, veth_rq_stats_desc[j].desc);
 				p += ETH_GSTRING_LEN;
 			}
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 2/4] net: dsa: mv88e6xxx: Fix -Wformat-security warnings
  2019-02-22  4:09 ` [PATCH net-next 2/4] net: dsa: mv88e6xxx: Fix -Wformat-security warnings Florian Fainelli
@ 2019-02-22 13:14   ` Andrew Lunn
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2019-02-22 13:14 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev, davem, Vivien Didelot, open list

On Thu, Feb 21, 2019 at 08:09:27PM -0800, Florian Fainelli wrote:
> We are not specifying an explicit format argument but instead passing a
> string litteral which causes these two warnings to show up:
> 
> drivers/net/dsa/mv88e6xxx/chip.c: In function
> 'mv88e6xxx_irq_poll_setup':
> drivers/net/dsa/mv88e6xxx/chip.c:483:2: warning: format not a string
> literal and no format arguments [-Wformat-security]
>   chip->kworker = kthread_create_worker(0, dev_name(chip->dev));
>   ^~~~
> drivers/net/dsa/mv88e6xxx/ptp.c: In function 'mv88e6xxx_ptp_setup':
> drivers/net/dsa/mv88e6xxx/ptp.c:403:4: warning: format not a string
> literal and no format arguments [-Wformat-security]
>     dev_name(chip->dev));
>     ^~~~~~~~
>   LD [M]  drivers/net/dsa/mv88e6xxx/mv88e6xxx.o
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Hi Florian

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/4] mlxsw: spectrum: Avoid -Wformat-truncation warnings
  2019-02-22  4:09 ` [PATCH net-next 1/4] mlxsw: spectrum: Avoid -Wformat-truncation warnings Florian Fainelli
@ 2019-02-22 13:25   ` Ido Schimmel
  0 siblings, 0 replies; 9+ messages in thread
From: Ido Schimmel @ 2019-02-22 13:25 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev, davem, Jiri Pirko, open list

On Thu, Feb 21, 2019 at 08:09:26PM -0800, Florian Fainelli wrote:
> Give precision identifiers to the two snprintf() formatting the priority
> and TC strings to avoid producing these two warnings:
> 
> drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function
> 'mlxsw_sp_port_get_prio_strings':
> drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2132:37: warning: '%d'
> directive output may be truncated writing between 1 and 3 bytes into a
> region of size between 0 and 31 [-Wformat-truncation=]
>    snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
>                                      ^~
> drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2132:3: note: 'snprintf'
> output between 3 and 36 bytes into a destination of size 32
>    snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      mlxsw_sp_port_hw_prio_stats[i].str, prio);
>      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function
> 'mlxsw_sp_port_get_tc_strings':
> drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2143:37: warning: '%d'
> directive output may be truncated writing between 1 and 11 bytes into a
> region of size between 0 and 31 [-Wformat-truncation=]
>    snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
>                                      ^~
> drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2143:3: note: 'snprintf'
> output between 3 and 44 bytes into a destination of size 32
>    snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      mlxsw_sp_port_hw_tc_stats[i].str, tc);
>      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Ido Schimmel <idosch@mellanox.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 0/4] -Wformat fixes
  2019-02-22  4:09 [PATCH net-next 0/4] -Wformat fixes Florian Fainelli
                   ` (3 preceding siblings ...)
  2019-02-22  4:09 ` [PATCH net-next 4/4] veth: Fix -Wformat-truncation Florian Fainelli
@ 2019-02-23 21:45 ` David Miller
  4 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2019-02-23 21:45 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Thu, 21 Feb 2019 20:09:25 -0800

> This is a collection of some -Wformat fixes found during build, nothing
> critical, but nice to have for people turning on more warnings with
> their builds.

Applied, thanks Florian.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Intel-wired-lan] [PATCH net-next 3/4] e1000e: Fix -Wformat-truncation warnings
  2019-02-22  4:09 ` [PATCH net-next 3/4] e1000e: Fix -Wformat-truncation warnings Florian Fainelli
@ 2019-02-25 18:26   ` Neftin, Sasha
  0 siblings, 0 replies; 9+ messages in thread
From: Neftin, Sasha @ 2019-02-25 18:26 UTC (permalink / raw)
  To: Florian Fainelli, netdev
  Cc: open list, moderated list:INTEL ETHERNET DRIVERS, davem

On 22/02/2019 6:09, Florian Fainelli wrote:
> 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>
> ---
>   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 736fa51878f8..7acc61e4f645 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -2106,7 +2106,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,
> @@ -2122,7 +2122,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,
> 
Acked-by: Sasha Neftin <sasha.neftin@intel.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-02-25 18:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22  4:09 [PATCH net-next 0/4] -Wformat fixes Florian Fainelli
2019-02-22  4:09 ` [PATCH net-next 1/4] mlxsw: spectrum: Avoid -Wformat-truncation warnings Florian Fainelli
2019-02-22 13:25   ` Ido Schimmel
2019-02-22  4:09 ` [PATCH net-next 2/4] net: dsa: mv88e6xxx: Fix -Wformat-security warnings Florian Fainelli
2019-02-22 13:14   ` Andrew Lunn
2019-02-22  4:09 ` [PATCH net-next 3/4] e1000e: Fix -Wformat-truncation warnings Florian Fainelli
2019-02-25 18:26   ` [Intel-wired-lan] " Neftin, Sasha
2019-02-22  4:09 ` [PATCH net-next 4/4] veth: Fix -Wformat-truncation Florian Fainelli
2019-02-23 21:45 ` [PATCH net-next 0/4] -Wformat fixes David Miller

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).