linux-stable/drivers/net/ethernet
Rahul Rameshbabu 1b2bd0c026 net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors
Treat the operation as an error case when the return value is equivalent to
the size of the name buffer. Failed to write null terminator to the name
buffer, making the string malformed and should not be used. Provide a
string with only the firmware version when forming the string with the
board id fails. This logic for representors is identical to normal flow
with ethtool.

Without check, will trigger -Wformat-truncation with W=1.

    drivers/net/ethernet/mellanox/mlx5/core/en_rep.c: In function 'mlx5e_rep_get_drvinfo':
    drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:78:31: warning: '%.16s' directive output may be truncated writing up to 16 bytes into a region of size between 13 and 22 [-Wformat-truncation=]
      78 |                  "%d.%d.%04d (%.16s)",
         |                               ^~~~~
    drivers/net/ethernet/mellanox/mlx5/core/en_rep.c:77:9: note: 'snprintf' output between 12 and 37 bytes into a destination of size 32
      77 |         snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      78 |                  "%d.%d.%04d (%.16s)",
         |                  ~~~~~~~~~~~~~~~~~~~~~
      79 |                  fw_rev_maj(mdev), fw_rev_min(mdev),
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      80 |                  fw_rev_sub(mdev), mdev->board_id);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: cf83c8fdcd ("net/mlx5e: Add missing ethtool driver info for representors")
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6d4ab2e97dcfbcd748ae71761a9d8e5e41cc732c
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Link: https://lore.kernel.org/r/20231114215846.5902-16-saeed@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-11-15 22:34:31 -08:00
..
3com
8390 net: ethernet: 8390: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
actions net: ethernet: actions: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
adaptec
adi net: ethernet: adi: adin1110: Fix uninitialized variable 2023-10-21 11:54:42 +01:00
aeroflex net: ethernet: aeroflex: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
agere et131x: Use pci_dev_id() to simplify the code 2023-08-13 12:30:39 +01:00
alacritech net: ethernet: slicoss: remove redundant increment of pointer data 2023-07-28 15:37:08 -07:00
allwinner net: ethernet: allwinner: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
alteon
altera net: ethernet: Use device_get_match_data() 2023-10-13 10:04:53 +01:00
amazon net: Tree wide: Replace xdp_do_flush_map() with xdp_do_flush(). 2023-10-03 07:34:51 -07:00
amd pds_core: fix up some format-truncation complaints 2023-11-14 19:52:09 -08:00
apm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-26 13:46:28 -07:00
apple net: ethernet: apple: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
aquantia
arc net: ethernet: arc: Convert to platform remove callback returning void 2023-09-20 09:06:37 +01:00
asix net: ax88796c: replace deprecated strncpy with strscpy 2023-10-06 15:55:29 -07:00
atheros netdev: use napi_schedule bool instead of napi_schedule_prep/__napi_schedule 2023-10-11 17:28:06 -07:00
broadcom tg3: Increment tx_dropped in tg3_tso_bug() 2023-11-14 19:50:23 -08:00
brocade asm-generic updates for v6.7 2023-11-01 15:28:33 -10:00
cadence net: ethernet: cadence: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
calxeda net: ethernet: calxeda: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
cavium cavium/liquidio: replace deprecated strncpy with strscpy 2023-10-09 19:43:14 -07:00
chelsio This update includes the following changes: 2023-11-02 16:15:30 -10:00
cirrus net: ethernet: cirrus: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
cisco
cortina net: ethernet: cortina: Fix MTU max setting 2023-11-13 20:58:20 -08:00
davicom net: ethernet: davicom: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
dec net: tulip: Annotate struct mediatable with __counted_by 2023-10-02 11:24:55 -07:00
dlink
emulex rtnetlink: remove redundant checks for nlattr IFLA_BRIDGE_MODE 2023-08-08 15:10:37 -07:00
engleder tsnep: Fix tsnep_request_irq() format-overflow warning 2023-10-24 13:05:28 -07:00
ezchip netdev: replace napi_reschedule with napi_schedule 2023-10-11 17:28:06 -07:00
faraday net: ethernet: faraday: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
freescale net: enetc: shorten enetc_setup_xdp_prog() error message to fit NETLINK_MAX_FMTMSG_LEN 2023-11-07 18:57:16 -08:00
fujitsu
fungible eth: add missing xdp.h includes in drivers 2023-08-03 08:38:07 -07:00
google gve: Fixes for napi_poll when budget is 0 2023-11-14 20:00:11 -08:00
hisilicon net: hns3: fix VF wrong speed and duplex issue 2023-11-13 09:06:58 +00:00
huawei hinic: devlink health: use retained error fmsg API 2023-10-20 11:34:50 +01:00
i825xx net: ethernet: i825xx: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
ibm ibmvnic: replace deprecated strncpy with strscpy 2023-10-13 10:18:20 +01:00
intel ice: fix DDP package download for packages without signature segment 2023-11-13 10:56:58 -08:00
litex net: ethernet: litex: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00
marvell net: mvneta: fix calls to page_pool_get_stats 2023-11-13 11:06:59 +00:00
mediatek net: ethernet: mtk_wed: remove wo pointer in wo_r32/wo_w32 signature 2023-10-24 17:08:46 -07:00
mellanox net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors 2023-11-15 22:34:31 -08:00
micrel net: ethernet: micrel: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00
microchip net: microchip: lan743x: improve throughput with rx timestamp config 2023-10-24 09:16:08 +02:00
microsoft net: mana: Use xdp_set_features_flag instead of direct assignment 2023-10-27 15:39:29 -07:00
moxa net: ethernet: moxa:: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00
mscc net: ethernet: mscc: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00
myricom
natsemi net: ethernet: natsemi: Convert to platform remove callback returning void 2023-09-20 09:06:40 +01:00
neterion ethernet: s2io: Use ether_addr_to_u64() to convert ethernet address 2023-08-09 15:26:49 -07:00
netronome nfp: using napi_build_skb() to replace build_skb() 2023-10-27 14:48:13 -07:00
ni netdev: replace napi_reschedule with napi_schedule 2023-10-11 17:28:06 -07:00
nvidia
nxp net: ethernet: nxp: Convert to platform remove callback returning void 2023-09-20 09:06:40 +01:00
oki-semi
packetengines
pasemi
pensando ionic: replace deprecated strncpy with strscpy 2023-10-13 17:10:36 -07:00
qlogic asm-generic updates for v6.7 2023-11-01 15:28:33 -10:00
qualcomm net: ethernet: qualcomm: Convert to platform remove callback returning void 2023-09-20 09:06:40 +01:00
rdc
realtek r8169: fix network lost after resume on DASH systems 2023-11-13 21:00:07 -08:00
renesas net: ethernet: renesas: drop SoC names in Kconfig 2023-10-24 16:16:19 -07:00
rocker
samsung net: ethernet: samsung: Convert to platform remove callback returning void 2023-09-20 09:06:40 +01:00
seeq net: ethernet: seeq: Convert to platform remove callback returning void 2023-09-20 09:06:40 +01:00
sfc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-26 13:46:28 -07:00
sgi net: ethernet: sgi: Convert to platform remove callback returning void 2023-09-20 09:06:40 +01:00
silan
sis
smsc sh updates for v6.7 2023-11-02 15:34:59 -10:00
socionext net: Tree wide: Replace xdp_do_flush_map() with xdp_do_flush(). 2023-10-03 07:34:51 -07:00
stmicro net: stmmac: avoid rx queue overrun 2023-11-14 19:48:03 -08:00
sun net: ethernet: sun: Convert to platform remove callback returning void 2023-09-20 09:06:41 +01:00
sunplus net: ethernet: sunplus: Convert to platform remove callback returning void 2023-09-20 09:06:41 +01:00
synopsys
tehuti
ti net: ti: icssg-prueth: Fix error cleanup on failing pruss_request_mem_region 2023-11-11 19:49:21 +00:00
toshiba Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-10-26 13:46:28 -07:00
tundra net: ethernet: tundra: Convert to platform remove callback returning void 2023-09-20 09:06:41 +01:00
vertexcom
via net: ethernet: via: Convert to platform remove callback returning void 2023-09-20 09:06:41 +01:00
wangxun net: wangxun: remove redundant kernel log 2023-10-18 17:57:36 -07:00
wiznet net: ethernet: wiznet: Use spi_get_device_match_data() 2023-10-13 10:05:49 +01:00
xilinx net: ethernet: xilinx: Drop kernel doc comment about return value 2023-10-01 14:00:27 +01:00
xircom
xscale net: xscale: Drop unused PHY number 2023-11-01 22:15:15 -07:00
Kconfig
Makefile
dnet.c net: ethernet: dnet: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
dnet.h
ec_bhf.c
ethoc.c net: ethernet: ethoc: Convert to platform remove callback returning void 2023-09-20 09:06:38 +01:00
fealnx.c
jme.c
jme.h
korina.c net: ethernet: korina: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00
lantiq_etop.c net: ethernet: lantiq_etop: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00
lantiq_xrx200.c net: ethernet: lantiq_xrx200: Convert to platform remove callback returning void 2023-09-20 09:06:39 +01:00