All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kernel@openeuler.org
Cc: oe-kbuild-all@lists.linux.dev
Subject: [openeuler:OLK-5.10 3011/3011] drivers/net/ethernet/mucse/rnpm/rnpm_sysfs.c:1524:2: warning: 'strncpy' specified bound 100 equals destination size
Date: Fri, 4 Jul 2025 16:24:15 +0800	[thread overview]
Message-ID: <202507041638.fqBxner2-lkp@intel.com> (raw)

tree:   https://gitee.com/openeuler/kernel.git OLK-5.10
head:   41b7827f33a9fc1fe425b85029312de34b0f0abe
commit: a0c5bfdbc099daf30cbadb9657803f0cb3f89d0b [3011/3011] drivers: support for rnpm drivers from Mucse Technology N10/N400
config: arm64-randconfig-004-20250704 (https://download.01.org/0day-ci/archive/20250704/202507041638.fqBxner2-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250704/202507041638.fqBxner2-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/202507041638.fqBxner2-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/mucse/rnpm/rnpm_sysfs.c:263:5: warning: no previous prototype for 'rnpm_mbx_get_pn_sn' [-Wmissing-prototypes]
     263 | int rnpm_mbx_get_pn_sn(struct rnpm_hw *hw, char pn[33], char sn[33])
         |     ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/mucse/rnpm/rnpm_sysfs.c: In function '_switch_loopback':
>> drivers/net/ethernet/mucse/rnpm/rnpm_sysfs.c:1524:2: warning: 'strncpy' specified bound 100 equals destination size [-Wstringop-truncation]
    1524 |  strncpy(name, peer_eth, sizeof(name));
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +1524 drivers/net/ethernet/mucse/rnpm/rnpm_sysfs.c

  1515	
  1516	static ssize_t _switch_loopback(struct rnpm_adapter *adapter,
  1517					const char *peer_eth, int en)
  1518	{
  1519		struct net_device *peer_netdev = NULL;
  1520		struct rnpm_adapter *peer_adapter = NULL;
  1521		int i;
  1522		char name[100];
  1523	
> 1524		strncpy(name, peer_eth, sizeof(name));
  1525		strim(name);
  1526	
  1527		peer_netdev = dev_get_by_name(&init_net, name);
  1528		if (!peer_netdev) {
  1529			e_dev_info("canot' find [%s]\n", name);
  1530			return -EINVAL;
  1531		}
  1532		peer_adapter = netdev_priv(peer_netdev);
  1533	
  1534		// check if in same slot
  1535		if (PCI_SLOT(peer_adapter->pdev->devfn) !=
  1536		    PCI_SLOT(adapter->pdev->devfn)) {
  1537			e_dev_info("%s %s not in same slot\n",
  1538				   netdev_name(adapter->netdev),
  1539				   netdev_name(peer_adapter->netdev));
  1540			dev_put(peer_netdev);
  1541			return -EINVAL;
  1542		}
  1543	
  1544		e_dev_info("%s: %s(%d,%d) <-> %s(%d,%d) en:%d\n", __func__,
  1545			   netdev_name(adapter->netdev), adapter->lane, adapter->port,
  1546			   netdev_name(peer_adapter->netdev), peer_adapter->lane,
  1547			   peer_adapter->port, en);
  1548	
  1549		/* clear pf0/pf1 input port policy eth reg */
  1550		for (i = 0; i < MAX_PORT_NUM; i++) {
  1551			wr32(&adapter->hw, RNPM_ETH_INPORT_POLICY_REG(i), 0);
  1552			wr32(&peer_adapter->hw, RNPM_ETH_INPORT_POLICY_REG(i), 0);
  1553		}
  1554	
  1555		wr32(&adapter->hw, RNPM_ETH_INPORT_POLICY_VAL, 0);
  1556		wr32(&peer_adapter->hw, RNPM_ETH_INPORT_POLICY_VAL, 0);
  1557	
  1558		do_switch_loopback_set(adapter, en, adapter->lane,
  1559				       to_switch_port(peer_adapter));
  1560	
  1561		do_switch_loopback_set(peer_adapter, en, peer_adapter->lane,
  1562				       to_switch_port(adapter));
  1563	
  1564		if (peer_netdev)
  1565			dev_put(peer_netdev);
  1566	
  1567		return 0;
  1568	}
  1569	static ssize_t switch_loopback_on_store(struct device *dev,
  1570						struct device_attribute *attr,
  1571						const char *buf, size_t count)
  1572	{
  1573		struct rnpm_adapter *adapter = netdev_priv(to_net_device(dev));
  1574	
  1575		return _switch_loopback(adapter, buf, 1) == 0 ? count : -EINVAL;
  1576	}
  1577	static DEVICE_ATTR_WO(switch_loopback_on);
  1578	

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

                 reply	other threads:[~2025-07-04  8:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202507041638.fqBxner2-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kernel@openeuler.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.