All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/net/ethernet/broadcom/bnxt/bnxt.c:7654 bnxt_accumulate_all_stats() error: potentially dereferencing uninitialized 'ring0_stats'.
Date: Mon, 05 Apr 2021 15:27:07 +0800	[thread overview]
Message-ID: <202104051500.2ffhWBiO-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4940 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Michael Chan <michael.chan@broadcom.com>
CC: Vasundhara Volam <vasundhara-v.volam@broadcom.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   e49d033bddf5b565044e2abe4241353959bc9120
commit: fea6b3335527f41bc729466fb2a95e48a98827ac bnxt_en: Accumulate all counters.
date:   8 months ago
:::::: branch date: 10 hours ago
:::::: commit date: 8 months ago
config: microblaze-randconfig-m031-20210405 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/net/ethernet/broadcom/bnxt/bnxt.c:7654 bnxt_accumulate_all_stats() error: potentially dereferencing uninitialized 'ring0_stats'.

Old smatch warnings:
drivers/net/ethernet/broadcom/bnxt/bnxt.c:1539 bnxt_tpa_end() warn: bitwise AND condition is false here
drivers/net/ethernet/broadcom/bnxt/bnxt.c:4876 bnxt_hwrm_vnic_set_tpa() warn: bitwise AND condition is false here
drivers/net/ethernet/broadcom/bnxt/bnxt.c:12283 bnxt_init_one() warn: missing error code 'rc'

vim +/ring0_stats +7654 drivers/net/ethernet/broadcom/bnxt/bnxt.c

fea6b3335527f4 Michael Chan 2020-07-27  7633  
fea6b3335527f4 Michael Chan 2020-07-27  7634  static void bnxt_accumulate_all_stats(struct bnxt *bp)
fea6b3335527f4 Michael Chan 2020-07-27  7635  {
fea6b3335527f4 Michael Chan 2020-07-27  7636  	struct bnxt_stats_mem *ring0_stats;
fea6b3335527f4 Michael Chan 2020-07-27  7637  	bool ignore_zero = false;
fea6b3335527f4 Michael Chan 2020-07-27  7638  	int i;
fea6b3335527f4 Michael Chan 2020-07-27  7639  
fea6b3335527f4 Michael Chan 2020-07-27  7640  	/* Chip bug.  Counter intermittently becomes 0. */
fea6b3335527f4 Michael Chan 2020-07-27  7641  	if (bp->flags & BNXT_FLAG_CHIP_P5)
fea6b3335527f4 Michael Chan 2020-07-27  7642  		ignore_zero = true;
fea6b3335527f4 Michael Chan 2020-07-27  7643  
fea6b3335527f4 Michael Chan 2020-07-27  7644  	for (i = 0; i < bp->cp_nr_rings; i++) {
fea6b3335527f4 Michael Chan 2020-07-27  7645  		struct bnxt_napi *bnapi = bp->bnapi[i];
fea6b3335527f4 Michael Chan 2020-07-27  7646  		struct bnxt_cp_ring_info *cpr;
fea6b3335527f4 Michael Chan 2020-07-27  7647  		struct bnxt_stats_mem *stats;
fea6b3335527f4 Michael Chan 2020-07-27  7648  
fea6b3335527f4 Michael Chan 2020-07-27  7649  		cpr = &bnapi->cp_ring;
fea6b3335527f4 Michael Chan 2020-07-27  7650  		stats = &cpr->stats;
fea6b3335527f4 Michael Chan 2020-07-27  7651  		if (!i)
fea6b3335527f4 Michael Chan 2020-07-27  7652  			ring0_stats = stats;
fea6b3335527f4 Michael Chan 2020-07-27  7653  		__bnxt_accumulate_stats(stats->hw_stats, stats->sw_stats,
fea6b3335527f4 Michael Chan 2020-07-27 @7654  					ring0_stats->hw_masks,
fea6b3335527f4 Michael Chan 2020-07-27  7655  					ring0_stats->len / 8, ignore_zero);
fea6b3335527f4 Michael Chan 2020-07-27  7656  	}
fea6b3335527f4 Michael Chan 2020-07-27  7657  	if (bp->flags & BNXT_FLAG_PORT_STATS) {
fea6b3335527f4 Michael Chan 2020-07-27  7658  		struct bnxt_stats_mem *stats = &bp->port_stats;
fea6b3335527f4 Michael Chan 2020-07-27  7659  		__le64 *hw_stats = stats->hw_stats;
fea6b3335527f4 Michael Chan 2020-07-27  7660  		u64 *sw_stats = stats->sw_stats;
fea6b3335527f4 Michael Chan 2020-07-27  7661  		u64 *masks = stats->hw_masks;
fea6b3335527f4 Michael Chan 2020-07-27  7662  		int cnt;
fea6b3335527f4 Michael Chan 2020-07-27  7663  
fea6b3335527f4 Michael Chan 2020-07-27  7664  		cnt = sizeof(struct rx_port_stats) / 8;
fea6b3335527f4 Michael Chan 2020-07-27  7665  		__bnxt_accumulate_stats(hw_stats, sw_stats, masks, cnt, false);
fea6b3335527f4 Michael Chan 2020-07-27  7666  
fea6b3335527f4 Michael Chan 2020-07-27  7667  		hw_stats += BNXT_TX_PORT_STATS_BYTE_OFFSET / 8;
fea6b3335527f4 Michael Chan 2020-07-27  7668  		sw_stats += BNXT_TX_PORT_STATS_BYTE_OFFSET / 8;
fea6b3335527f4 Michael Chan 2020-07-27  7669  		masks += BNXT_TX_PORT_STATS_BYTE_OFFSET / 8;
fea6b3335527f4 Michael Chan 2020-07-27  7670  		cnt = sizeof(struct tx_port_stats) / 8;
fea6b3335527f4 Michael Chan 2020-07-27  7671  		__bnxt_accumulate_stats(hw_stats, sw_stats, masks, cnt, false);
fea6b3335527f4 Michael Chan 2020-07-27  7672  	}
fea6b3335527f4 Michael Chan 2020-07-27  7673  	if (bp->flags & BNXT_FLAG_PORT_STATS_EXT) {
fea6b3335527f4 Michael Chan 2020-07-27  7674  		bnxt_accumulate_stats(&bp->rx_port_stats_ext);
fea6b3335527f4 Michael Chan 2020-07-27  7675  		bnxt_accumulate_stats(&bp->tx_port_stats_ext);
fea6b3335527f4 Michael Chan 2020-07-27  7676  	}
fea6b3335527f4 Michael Chan 2020-07-27  7677  }
fea6b3335527f4 Michael Chan 2020-07-27  7678  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27483 bytes --]

             reply	other threads:[~2021-04-05  7:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05  7:27 kernel test robot [this message]
2021-06-16 18:42 drivers/net/ethernet/broadcom/bnxt/bnxt.c:7654 bnxt_accumulate_all_stats() error: potentially dereferencing uninitialized 'ring0_stats' kernel test robot
2021-07-05  7:14 kernel test robot
2023-11-12 20:54 kernel test robot

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=202104051500.2ffhWBiO-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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.