[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202505161058.QFYrp89W-lkp@intel.com>
Date: Fri, 16 May 2025 10:54:47 +0800
From: kernel test robot <lkp@...el.com>
To: Michael Chan <michael.chan@...adcom.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Shruti Parab <shruti.parab@...adcom.com>,
Kalesh AP <kalesh-anakkur.purayil@...adcom.com>,
Andy Gospodarek <andrew.gospodarek@...adcom.com>
Subject: drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2120
bnxt_get_regs() warn: unsigned 'j' is never less than zero.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fee3e843b309444f48157e2188efa6818bae85cf
commit: 02e8be5a032cae0f4ca33c6053c44d83cf4acc93 bnxt_en: Fix ethtool -d byte order for 32-bit values
date: 2 weeks ago
config: x86_64-randconfig-161-20250516 (https://download.01.org/0day-ci/archive/20250516/202505161058.QFYrp89W-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505161058.QFYrp89W-lkp@intel.com/
smatch warnings:
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2120 bnxt_get_regs() warn: unsigned 'j' is never less than zero.
vim +/j +2120 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
2075
2076 static void bnxt_get_regs(struct net_device *dev, struct ethtool_regs *regs,
2077 void *_p)
2078 {
2079 struct pcie_ctx_hw_stats *hw_pcie_stats;
2080 struct hwrm_pcie_qstats_input *req;
2081 struct bnxt *bp = netdev_priv(dev);
2082 dma_addr_t hw_pcie_stats_addr;
2083 int rc;
2084
2085 regs->version = 0;
2086 if (!(bp->fw_dbg_cap & DBG_QCAPS_RESP_FLAGS_REG_ACCESS_RESTRICTED))
2087 bnxt_dbg_hwrm_rd_reg(bp, 0, BNXT_PXP_REG_LEN / 4, _p);
2088
2089 if (!(bp->fw_cap & BNXT_FW_CAP_PCIE_STATS_SUPPORTED))
2090 return;
2091
2092 if (hwrm_req_init(bp, req, HWRM_PCIE_QSTATS))
2093 return;
2094
2095 hw_pcie_stats = hwrm_req_dma_slice(bp, req, sizeof(*hw_pcie_stats),
2096 &hw_pcie_stats_addr);
2097 if (!hw_pcie_stats) {
2098 hwrm_req_drop(bp, req);
2099 return;
2100 }
2101
2102 regs->version = 1;
2103 hwrm_req_hold(bp, req); /* hold on to slice */
2104 req->pcie_stat_size = cpu_to_le16(sizeof(*hw_pcie_stats));
2105 req->pcie_stat_host_addr = cpu_to_le64(hw_pcie_stats_addr);
2106 rc = hwrm_req_send(bp, req);
2107 if (!rc) {
2108 u8 *dst = (u8 *)(_p + BNXT_PXP_REG_LEN);
2109 u8 *src = (u8 *)hw_pcie_stats;
2110 int i, j;
2111
2112 for (i = 0, j = 0; i < sizeof(*hw_pcie_stats); ) {
2113 if (i >= bnxt_pcie_32b_entries[j].start &&
2114 i <= bnxt_pcie_32b_entries[j].end) {
2115 u32 *dst32 = (u32 *)(dst + i);
2116
2117 *dst32 = le32_to_cpu(*(__le32 *)(src + i));
2118 i += 4;
2119 if (i > bnxt_pcie_32b_entries[j].end &&
> 2120 j < ARRAY_SIZE(bnxt_pcie_32b_entries) - 1)
2121 j++;
2122 } else {
2123 u64 *dst64 = (u64 *)(dst + i);
2124
2125 *dst64 = le64_to_cpu(*(__le64 *)(src + i));
2126 i += 8;
2127 }
2128 }
2129 }
2130 hwrm_req_drop(bp, req);
2131 }
2132
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists