From: "Neftin, Sasha" <sasha.neftin@intel.com>
To: Florian Fainelli <f.fainelli@gmail.com>, netdev@vger.kernel.org
Cc: open list <linux-kernel@vger.kernel.org>,
"moderated list:INTEL ETHERNET DRIVERS"
<intel-wired-lan@lists.osuosl.org>,
davem@davemloft.net
Subject: Re: [Intel-wired-lan] [PATCH net-next 3/4] e1000e: Fix -Wformat-truncation warnings
Date: Mon, 25 Feb 2019 20:26:13 +0200 [thread overview]
Message-ID: <69782768-4bba-6442-a1e4-3b019847e53b@intel.com> (raw)
In-Reply-To: <20190222040929.16657-4-f.fainelli@gmail.com>
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>
next prev parent reply other threads:[~2019-02-25 18:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190222040929.16657-1-f.fainelli@gmail.com>
2019-02-22 4:09 ` [PATCH net-next 1/4] mlxsw: spectrum: Avoid " 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 ` Neftin, Sasha [this message]
2019-02-22 4:09 ` [PATCH net-next 4/4] veth: Fix -Wformat-truncation Florian Fainelli
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=69782768-4bba-6442-a1e4-3b019847e53b@intel.com \
--to=sasha.neftin@intel.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@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
all inboxes | Powered by JetHome®