public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c:1833:4: warning: 'snprintf' will always be truncated; specified size is 80, but format string expands to at least 94
@ 2024-01-10 14:55 kernel test robot
  2024-01-12 19:47 ` Nathan Chancellor
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2024-01-10 14:55 UTC (permalink / raw)
  To: Vlad Buslov
  Cc: llvm, oe-kbuild-all, linux-kernel, Saeed Mahameed, Maor Dickman,
	Roi Dayan

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ab27740f76654ed58dd32ac0ba0031c18a6dea3b
commit: 70f0302b3f2053b64a6a653a76a20cb95438dc85 net/mlx5: Bridge, implement mdb offload
date:   9 months ago
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20240110/202401102205.XmxWrS5y-lkp@intel.com/config)
compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 7e186d366d6c7def0543acc255931f617e76dff0)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240110/202401102205.XmxWrS5y-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401102205.XmxWrS5y-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c:1833:4: warning: 'snprintf' will always be truncated; specified size is 80, but format string expands to at least 94 [-Wformat-truncation-non-kprintf]
    1833 |                         NL_SET_ERR_MSG_FMT_MOD(extack,
         |                         ^
   include/linux/netlink.h:130:2: note: expanded from macro 'NL_SET_ERR_MSG_FMT_MOD'
     130 |         NL_SET_ERR_MSG_FMT((extack), KBUILD_MODNAME ": " fmt, ##args)
         |         ^
   include/linux/netlink.h:115:6: note: expanded from macro 'NL_SET_ERR_MSG_FMT'
     115 |         if (snprintf(__extack->_msg_buf, NETLINK_MAX_FMTMSG_LEN,               \
         |             ^
   1 warning generated.


vim +/snprintf +1833 drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c

  1805	
  1806	int mlx5_esw_bridge_port_mdb_add(u16 vport_num, u16 esw_owner_vhca_id, const unsigned char *addr,
  1807					 u16 vid, struct mlx5_esw_bridge_offloads *br_offloads,
  1808					 struct netlink_ext_ack *extack)
  1809	{
  1810		struct mlx5_esw_bridge_vlan *vlan;
  1811		struct mlx5_esw_bridge_port *port;
  1812		struct mlx5_esw_bridge *bridge;
  1813		int err;
  1814	
  1815		port = mlx5_esw_bridge_port_lookup(vport_num, esw_owner_vhca_id, br_offloads);
  1816		if (!port) {
  1817			esw_warn(br_offloads->esw->dev,
  1818				 "Failed to lookup bridge port to add MDB (MAC=%pM,vport=%u)\n",
  1819				 addr, vport_num);
  1820			NL_SET_ERR_MSG_FMT_MOD(extack,
  1821					       "Failed to lookup bridge port to add MDB (MAC=%pM,vport=%u)\n",
  1822					       addr, vport_num);
  1823			return -EINVAL;
  1824		}
  1825	
  1826		bridge = port->bridge;
  1827		if (bridge->flags & MLX5_ESW_BRIDGE_VLAN_FILTERING_FLAG && vid) {
  1828			vlan = mlx5_esw_bridge_vlan_lookup(vid, port);
  1829			if (!vlan) {
  1830				esw_warn(br_offloads->esw->dev,
  1831					 "Failed to lookup bridge port vlan metadata to create MDB (MAC=%pM,vid=%u,vport=%u)\n",
  1832					 addr, vid, vport_num);
> 1833				NL_SET_ERR_MSG_FMT_MOD(extack,
  1834						       "Failed to lookup bridge port vlan metadata to create MDB (MAC=%pM,vid=%u,vport=%u)\n",
  1835						       addr, vid, vport_num);
  1836				return -EINVAL;
  1837			}
  1838		}
  1839	
  1840		err = mlx5_esw_bridge_port_mdb_attach(port, addr, vid);
  1841		if (err) {
  1842			NL_SET_ERR_MSG_FMT_MOD(extack, "Failed to add MDB (MAC=%pM,vid=%u,vport=%u)\n",
  1843					       addr, vid, vport_num);
  1844			return err;
  1845		}
  1846	
  1847		return 0;
  1848	}
  1849	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c:1833:4: warning: 'snprintf' will always be truncated; specified size is 80, but format string expands to at least 94
  2024-01-10 14:55 drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c:1833:4: warning: 'snprintf' will always be truncated; specified size is 80, but format string expands to at least 94 kernel test robot
@ 2024-01-12 19:47 ` Nathan Chancellor
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2024-01-12 19:47 UTC (permalink / raw)
  To: kernel test robot
  Cc: Vlad Buslov, llvm, oe-kbuild-all, linux-kernel, Saeed Mahameed,
	Maor Dickman, Roi Dayan, masahiroy

On Wed, Jan 10, 2024 at 10:55:22PM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   ab27740f76654ed58dd32ac0ba0031c18a6dea3b
> commit: 70f0302b3f2053b64a6a653a76a20cb95438dc85 net/mlx5: Bridge, implement mdb offload
> date:   9 months ago
> config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20240110/202401102205.XmxWrS5y-lkp@intel.com/config)
> compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 7e186d366d6c7def0543acc255931f617e76dff0)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240110/202401102205.XmxWrS5y-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202401102205.XmxWrS5y-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
> >> drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c:1833:4: warning: 'snprintf' will always be truncated; specified size is 80, but format string expands to at least 94 [-Wformat-truncation-non-kprintf]
>     1833 |                         NL_SET_ERR_MSG_FMT_MOD(extack,
>          |                         ^
>    include/linux/netlink.h:130:2: note: expanded from macro 'NL_SET_ERR_MSG_FMT_MOD'
>      130 |         NL_SET_ERR_MSG_FMT((extack), KBUILD_MODNAME ": " fmt, ##args)
>          |         ^
>    include/linux/netlink.h:115:6: note: expanded from macro 'NL_SET_ERR_MSG_FMT'
>      115 |         if (snprintf(__extack->_msg_buf, NETLINK_MAX_FMTMSG_LEN,               \
>          |             ^
>    1 warning generated.

I have not looked to see if this is a legitimate issue or not, as clang
does not understand the kernel's special %p modifiers, so it is a little
hard to tell at first glance. For this reason, I sent a patch turning
off the -non-kprintf warnings but it has not been picked up yet:

https://lore.kernel.org/20231002-disable-wformat-truncation-overflow-non-kprintf-v1-1-35179205c8d9@kernel.org/

Cheers,
Nathan

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

end of thread, other threads:[~2024-01-12 19:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 14:55 drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c:1833:4: warning: 'snprintf' will always be truncated; specified size is 80, but format string expands to at least 94 kernel test robot
2024-01-12 19:47 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox