From: Dan Carpenter <dan.carpenter@oracle.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [bug report] iavf: allow null RX descriptors
Date: Mon, 24 Jun 2019 15:19:02 +0300 [thread overview]
Message-ID: <20190624121902.GR18776@kadam> (raw)
In-Reply-To: <20190620074516.GA12233@mwanda>
On Thu, Jun 20, 2019 at 10:45:16AM +0300, Dan Carpenter wrote:
> Hello Mitch Williams,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch efa14c398582: "iavf: allow null RX descriptors" from May
> 14, 2019, leads to the following Smatch complaint:
>
> drivers/net/ethernet/intel/iavf/iavf_txrx.c:1533 iavf_clean_rx_irq()
> warn: variable dereferenced before check 'rx_buffer' (see line 1526)
>
> drivers/net/ethernet/intel/iavf/iavf_txrx.c
> 1515
> 1516 size = (qword & IAVF_RXD_QW1_LENGTH_PBUF_MASK) >>
> 1517 IAVF_RXD_QW1_LENGTH_PBUF_SHIFT;
> 1518
> 1519 iavf_trace(clean_rx_irq, rx_ring, rx_desc, skb);
> 1520 rx_buffer = iavf_get_rx_buffer(rx_ring, size);
> 1521
> 1522 /* retrieve a buffer from the ring */
> 1523 if (skb)
>
> skb is non-NULL so ignore this path.
>
> 1524 iavf_add_rx_frag(rx_ring, rx_buffer, skb, size);
> 1525 else if (ring_uses_build_skb(rx_ring))
> 1526 skb = iavf_build_skb(rx_ring, rx_buffer, size);
> ^^^^^^^^^
> 1527 else
> 1528 skb = iavf_construct_skb(rx_ring, rx_buffer, size);
> ^^^^^^^^^
> These functions both dereference "rx_buffer" and might set skb to NULL.
Oh... Huh. They aren't *supposed* to dereference rx_buffer, but the
NULL checks are too late.
regards,
dan carpenter
prev parent reply other threads:[~2019-06-24 12:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 7:45 [Intel-wired-lan] [bug report] iavf: allow null RX descriptors Dan Carpenter
2019-06-24 12:19 ` Dan Carpenter [this message]
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=20190624121902.GR18776@kadam \
--to=dan.carpenter@oracle.com \
--cc=intel-wired-lan@osuosl.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.