From: kernel test robot <lkp@intel.com>
To: Michael Chan <michael.chan@broadcom.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Shruti Parab <shruti.parab@broadcom.com>,
Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,
Andy Gospodarek <andrew.gospodarek@broadcom.com>
Subject: drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2120 bnxt_get_regs() warn: unsigned 'j' is never less than zero.
Date: Fri, 16 May 2025 10:54:47 +0800 [thread overview]
Message-ID: <202505161058.QFYrp89W-lkp@intel.com> (raw)
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@intel.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
reply other threads:[~2025-05-16 2:54 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=202505161058.QFYrp89W-lkp@intel.com \
--to=lkp@intel.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.chan@broadcom.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=shruti.parab@broadcom.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®