No description
Find a file
Ido Schimmel 392ce2abb0 mlxsw: spectrum_ethtool: Fix -Wformat-truncation warning
Ethtool stats strings cannot be longer than 32 characters
('ETH_GSTRING_LEN'), including the terminating null byte. The format
string '%.29s_%.1d' can exceed this limitation if the per-TC counter
name exceeds 28 characters. Together with the underscore, the two digits
of the TC (bounded at 16) and the terminating null byte, more than 32
characters will be used.

Fix this by bounding the counter name at 28 characters which suppresses
the following build warning [1]. This does not affect ethtool output
since the longest counter name does not exceed this limitation.

[1]
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c: In function ‘mlxsw_sp_port_get_strings’:
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c:622:58: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  622 |                 snprintf(*p, ETH_GSTRING_LEN, "%.29s_%.1d",
      |                                                          ^
In function ‘mlxsw_sp_port_get_tc_strings’,
    inlined from ‘mlxsw_sp_port_get_strings’ at drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c:677:4:
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c:622:17: note: ‘snprintf’ output between 3 and 33 bytes into a destination of size 32
  622 |                 snprintf(*p, ETH_GSTRING_LEN, "%.29s_%.1d",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  623 |                          mlxsw_sp_port_hw_tc_stats[i].str, tc);
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c: In function ‘mlxsw_sp_port_get_strings’:
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c:622:58: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  622 |                 snprintf(*p, ETH_GSTRING_LEN, "%.29s_%.1d",
      |                                                          ^
In function ‘mlxsw_sp_port_get_tc_strings’,
    inlined from ‘mlxsw_sp_port_get_strings’ at drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c:677:4:
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c:622:17: note: ‘snprintf’ output between 3 and 33 bytes into a destination of size 32
  622 |                 snprintf(*p, ETH_GSTRING_LEN, "%.29s_%.1d",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  623 |                          mlxsw_sp_port_hw_tc_stats[i].str, tc);
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Simon Horman <horms@kernel.org> # build-tested
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-10-10 12:15:50 +02:00
arch Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-05 13:16:47 -07:00
block
certs
crypto
Documentation netlink: specs: remove redundant type keys from attributes in subsets 2023-10-09 19:44:57 -07:00
drivers mlxsw: spectrum_ethtool: Fix -Wformat-truncation warning 2023-10-10 12:15:50 +02:00
fs overlayfs fixes for 6.6-rc5 2023-10-05 10:56:18 -07:00
include tcp: record last received ipv6 flowlabel 2023-10-10 10:02:59 +02:00
init
io_uring
ipc
kernel Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-05 13:16:47 -07:00
lib Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-05 13:16:47 -07:00
LICENSES
mm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-05 13:16:47 -07:00
net tcp: change data receiver flowlabel after one dup 2023-10-10 10:02:59 +02:00
rust
samples
scripts
security
sound
tools tools: ynl-gen: handle do ops with no input attrs 2023-10-09 19:45:15 -07:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap MAINTAINERS: update Matthieu's email address 2023-10-05 09:34:32 -07:00
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS MAINTAINERS: Update LL TEMAC entry to Orphan 2023-10-06 15:49:08 -07:00
Makefile
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.