Commit e6f7ae95 authored by Dong Yibo's avatar Dong Yibo
Browse files

RNP: NET: Fix "'snprintf' output between 10 and 37 bytes into a

	  destination of size 24" wanrings

mucse inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9F4IW


CVE: NA

--------------------------------

LKP reports below warning when building for loongarch64 with "W=1 build"
...skipping...
drivers/net/ethernet/mucse/rnp/rnp_main.c:2401:25: note: 'snprintf' output
	between 10 and 37 bytes into a destination of size 24
2401 |                      snprintf(q_vector->name,
  |                         ^~~~~~~~~~~~~~~~~~~~~~~~
2402 |                          sizeof(q_vector->name) - 1, "%s-%s-%d-%d",
  |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2403 |                          netdev->name, "TxRx", i, q_vector->v_idx);
  |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202403080412.gcDr9v5Q-lkp@intel.com/


Signed-off-by: default avatarDong Yibo <dong100@mucse.com>
parent 2651d161
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -2345,8 +2345,8 @@ static int rnp_request_msix_irqs(struct rnp_adapter *adapter)

		if (q_vector->tx.ring && q_vector->rx.ring) {
			snprintf(q_vector->name,
				 sizeof(q_vector->name) - 1, "%s-%s-%d-%d",
				 netdev->name, "TxRx", i, q_vector->v_idx);
				 sizeof(q_vector->name), "%s-%s-%u",
				 netdev->name, "TxRx", i);
		} else {
			WARN(!(q_vector->tx.ring && q_vector->rx.ring),
			     "%s vector%d tx rx is null, v_idx:%d\n",
@@ -5731,7 +5731,8 @@ static int rnp_ioctl(struct net_device *netdev, struct ifreq *req, int cmd)

#ifdef CONFIG_NET_POLL_CONTROLLER
/**
 * Polling 'interrupt' - used by things like netconsole to send skbs
 * rnp_netpoll - used by things like netconsole to send skbs
 * @netdev: netdev
 * without having to re-enable interrupts. It's not called while
 * the interrupt routine is executing.
 */
+5 −2
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ static int rnp_mbx_write_posted_locked(struct rnp_hw *hw,
}

/**
 * force firmware report link event to driver
 * rnp_link_stat_mark_reset -force firmware report link event to driver
 * @hw: hw struct
 */
static void rnp_link_stat_mark_reset(struct rnp_hw *hw)
{
@@ -597,13 +598,15 @@ int rnp_mbx_reg_write(struct rnp_hw *hw, int fw_reg, int value)
{
	struct mbx_fw_cmd_req req;
	int err;
	int temp[4];

	memset(&req, 0, sizeof(req));
	temp[0] = value;

	if (hw->fw_version < 0x00050200)
		return -EOPNOTSUPP;

	build_writereg_req(&req, NULL, fw_reg, 4, &value);
	build_writereg_req(&req, NULL, fw_reg, 4, temp);
	err = rnp_mbx_write_posted_locked(hw, &req);

	return err;