From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Yue Haibing <yuehaibing@huawei.com>,
Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [Intel-wired-lan] [bug report] ixgbe: Fix passing 0 to ERR_PTR in ixgbe_run_xdp()
Date: Tue, 14 Jan 2025 12:11:37 +0100 [thread overview]
Message-ID: <c1fd73ab-1a96-4a60-99b6-5e632fa03372@intel.com> (raw)
In-Reply-To: <2c7d6c31-192a-4047-bd90-9566d0e14cc0@stanley.mountain>
On 1/10/25 07:34, Dan Carpenter wrote:
> Hello Yue Haibing,
>
Dan, Thank you for the report.
@Piotr, could you please fix it?
> Commit c824125cbb18 ("ixgbe: Fix passing 0 to ERR_PTR in
> ixgbe_run_xdp()") from Jan 6, 2025 (linux-next), leads to the
> following Smatch static checker warning:
>
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:2108 ixgbe_put_rx_buffer()
> warn: possible NULL dereference of 'skb'
>
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> 2099 static void ixgbe_put_rx_buffer(struct ixgbe_ring *rx_ring,
> 2100 struct ixgbe_rx_buffer *rx_buffer,
> 2101 struct sk_buff *skb,
> 2102 int rx_buffer_pgcnt)
> 2103 {
> 2104 if (ixgbe_can_reuse_rx_page(rx_buffer, rx_buffer_pgcnt)) {
> 2105 /* hand second half of page back to the ring */
> 2106 ixgbe_reuse_rx_page(rx_ring, rx_buffer);
> 2107 } else {
> --> 2108 if (!IS_ERR(skb) && IXGBE_CB(skb)->dma == rx_buffer->dma) {
> ^^^
> This can't be an error pointer and probably it should be a NULL check.
> I'm not sure if your patch introduced this issue or just exposed it.
>
> 2109 /* the page has been released from the ring */
> 2110 IXGBE_CB(skb)->page_released = true;
> 2111 } else {
> 2112 /* we are not reusing the buffer so unmap it */
> 2113 dma_unmap_page_attrs(rx_ring->dev, rx_buffer->dma,
> 2114 ixgbe_rx_pg_size(rx_ring),
> 2115 DMA_FROM_DEVICE,
> 2116 IXGBE_RX_DMA_ATTR);
> 2117 }
> 2118 __page_frag_cache_drain(rx_buffer->page,
> 2119 rx_buffer->pagecnt_bias);
> 2120 }
> 2121
> 2122 /* clear contents of rx_buffer */
> 2123 rx_buffer->page = NULL;
> 2124 rx_buffer->skb = NULL;
> 2125 }
>
> regards,
> dan carpenter
prev parent reply other threads:[~2025-01-14 11:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 6:34 [Intel-wired-lan] [bug report] ixgbe: Fix passing 0 to ERR_PTR in ixgbe_run_xdp() Dan Carpenter
2025-01-14 11:11 ` Przemek Kitszel [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=c1fd73ab-1a96-4a60-99b6-5e632fa03372@intel.com \
--to=przemyslaw.kitszel@intel.com \
--cc=dan.carpenter@linaro.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=piotr.kwapulinski@intel.com \
--cc=yuehaibing@huawei.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 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.