All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [linux-next:master 3337/11397] drivers/net/ethernet/pensando/ionic/ionic_txrx.c:149 ionic_rx_frags() warn: variable dereferenced before check 'buf_info->page' (see line 137)
Date: Wed, 01 Sep 2021 04:35:37 +0800	[thread overview]
Message-ID: <202109010423.edoFX6Lb-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Shannon Nelson <snelson@pensando.io>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   52c7b727581fe725f8b8a283af21fe0651c73c48
commit: e75ccac1d0644c9d7ad531cb9a81c499930c06da [3337/11397] ionic: use fewer inits on the buf_info struct
:::::: branch date: 12 hours ago
:::::: commit date: 5 weeks ago
config: x86_64-randconfig-m031-20210831 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 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>

smatch warnings:
drivers/net/ethernet/pensando/ionic/ionic_txrx.c:149 ionic_rx_frags() warn: variable dereferenced before check 'buf_info->page' (see line 137)

vim +149 drivers/net/ethernet/pensando/ionic/ionic_txrx.c

2b5720f26908571 Shannon Nelson 2021-03-10  118  
08f2e4b2b2008ce Shannon Nelson 2019-10-23  119  static struct sk_buff *ionic_rx_frags(struct ionic_queue *q,
08f2e4b2b2008ce Shannon Nelson 2019-10-23  120  				      struct ionic_desc_info *desc_info,
a25edab93b2877f Shannon Nelson 2021-03-10  121  				      struct ionic_rxq_comp *comp)
0f3154e6bcb3549 Shannon Nelson 2019-09-03  122  {
89e572e7369fd9a Shannon Nelson 2021-03-10  123  	struct net_device *netdev = q->lif->netdev;
4b0a7539a3728f0 Shannon Nelson 2021-03-10  124  	struct ionic_buf_info *buf_info;
89e572e7369fd9a Shannon Nelson 2021-03-10  125  	struct ionic_rx_stats *stats;
f37bc3462e80d2d Shannon Nelson 2021-03-10  126  	struct device *dev = q->dev;
08f2e4b2b2008ce Shannon Nelson 2019-10-23  127  	struct sk_buff *skb;
08f2e4b2b2008ce Shannon Nelson 2019-10-23  128  	unsigned int i;
08f2e4b2b2008ce Shannon Nelson 2019-10-23  129  	u16 frag_len;
08f2e4b2b2008ce Shannon Nelson 2019-10-23  130  	u16 len;
08f2e4b2b2008ce Shannon Nelson 2019-10-23  131  
89e572e7369fd9a Shannon Nelson 2021-03-10  132  	stats = q_to_rx_stats(q);
89e572e7369fd9a Shannon Nelson 2021-03-10  133  
4b0a7539a3728f0 Shannon Nelson 2021-03-10  134  	buf_info = &desc_info->bufs[0];
08f2e4b2b2008ce Shannon Nelson 2019-10-23  135  	len = le16_to_cpu(comp->len);
08f2e4b2b2008ce Shannon Nelson 2019-10-23  136  
e75ccac1d0644c9 Shannon Nelson 2021-07-27 @137  	prefetchw(buf_info->page);
08f2e4b2b2008ce Shannon Nelson 2019-10-23  138  
89e572e7369fd9a Shannon Nelson 2021-03-10  139  	skb = napi_get_frags(&q_to_qcq(q)->napi);
89e572e7369fd9a Shannon Nelson 2021-03-10  140  	if (unlikely(!skb)) {
89e572e7369fd9a Shannon Nelson 2021-03-10  141  		net_warn_ratelimited("%s: SKB alloc failed on %s!\n",
89e572e7369fd9a Shannon Nelson 2021-03-10  142  				     netdev->name, q->name);
89e572e7369fd9a Shannon Nelson 2021-03-10  143  		stats->alloc_err++;
08f2e4b2b2008ce Shannon Nelson 2019-10-23  144  		return NULL;
89e572e7369fd9a Shannon Nelson 2021-03-10  145  	}
08f2e4b2b2008ce Shannon Nelson 2019-10-23  146  
08f2e4b2b2008ce Shannon Nelson 2019-10-23  147  	i = comp->num_sg_elems + 1;
08f2e4b2b2008ce Shannon Nelson 2019-10-23  148  	do {
4b0a7539a3728f0 Shannon Nelson 2021-03-10 @149  		if (unlikely(!buf_info->page)) {
08f2e4b2b2008ce Shannon Nelson 2019-10-23  150  			dev_kfree_skb(skb);
08f2e4b2b2008ce Shannon Nelson 2019-10-23  151  			return NULL;
0f3154e6bcb3549 Shannon Nelson 2019-09-03  152  		}
0f3154e6bcb3549 Shannon Nelson 2019-09-03  153  
4b0a7539a3728f0 Shannon Nelson 2021-03-10  154  		frag_len = min_t(u16, len, IONIC_PAGE_SIZE - buf_info->page_offset);
08f2e4b2b2008ce Shannon Nelson 2019-10-23  155  		len -= frag_len;
08f2e4b2b2008ce Shannon Nelson 2019-10-23  156  
4b0a7539a3728f0 Shannon Nelson 2021-03-10  157  		dma_sync_single_for_cpu(dev,
4b0a7539a3728f0 Shannon Nelson 2021-03-10  158  					buf_info->dma_addr + buf_info->page_offset,
4b0a7539a3728f0 Shannon Nelson 2021-03-10  159  					frag_len, DMA_FROM_DEVICE);
4b0a7539a3728f0 Shannon Nelson 2021-03-10  160  
08f2e4b2b2008ce Shannon Nelson 2019-10-23  161  		skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
4b0a7539a3728f0 Shannon Nelson 2021-03-10  162  				buf_info->page, buf_info->page_offset, frag_len,
4b0a7539a3728f0 Shannon Nelson 2021-03-10  163  				IONIC_PAGE_SIZE);
4b0a7539a3728f0 Shannon Nelson 2021-03-10  164  
4b0a7539a3728f0 Shannon Nelson 2021-03-10  165  		if (!ionic_rx_buf_recycle(q, buf_info, frag_len)) {
4b0a7539a3728f0 Shannon Nelson 2021-03-10  166  			dma_unmap_page(dev, buf_info->dma_addr,
4b0a7539a3728f0 Shannon Nelson 2021-03-10  167  				       IONIC_PAGE_SIZE, DMA_FROM_DEVICE);
e75ccac1d0644c9 Shannon Nelson 2021-07-27  168  			buf_info->page = NULL;
4b0a7539a3728f0 Shannon Nelson 2021-03-10  169  		}
4b0a7539a3728f0 Shannon Nelson 2021-03-10  170  
4b0a7539a3728f0 Shannon Nelson 2021-03-10  171  		buf_info++;
4b0a7539a3728f0 Shannon Nelson 2021-03-10  172  
08f2e4b2b2008ce Shannon Nelson 2019-10-23  173  		i--;
08f2e4b2b2008ce Shannon Nelson 2019-10-23  174  	} while (i > 0);
08f2e4b2b2008ce Shannon Nelson 2019-10-23  175  
08f2e4b2b2008ce Shannon Nelson 2019-10-23  176  	return skb;
0f3154e6bcb3549 Shannon Nelson 2019-09-03  177  }
0f3154e6bcb3549 Shannon Nelson 2019-09-03  178  

:::::: The code at line 149 was first introduced by commit
:::::: 4b0a7539a3728f0fd7a11087d64371e8c28b4723 ionic: implement Rx page reuse

:::::: TO: Shannon Nelson <snelson@pensando.io>
:::::: CC: David S. Miller <davem@davemloft.net>

---
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: 36417 bytes --]

                 reply	other threads:[~2021-08-31 20:35 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=202109010423.edoFX6Lb-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.