netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@mellanox.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Jiri Pirko <jiri@mellanox.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 1/4] mlxsw: spectrum: Avoid -Wformat-truncation warnings
Date: Fri, 22 Feb 2019 13:25:15 +0000	[thread overview]
Message-ID: <20190222132512.GA24455@splinter> (raw)
In-Reply-To: <20190222040929.16657-2-f.fainelli@gmail.com>

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>

  reply	other threads:[~2019-02-22 13:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20190222132512.GA24455@splinter \
    --to=idosch@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=jiri@mellanox.com \
    --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;
as well as URLs for NNTP newsgroup(s).