All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] net: axienet: Introduce dmaengine support
Date: Thu, 7 Aug 2025 18:59:33 +0300	[thread overview]
Message-ID: <aJTNZQBAuY83TN2h@stanley.mountain> (raw)

Hello Radhey Shyam Pandey,

Commit 6a91b846af85 ("net: axienet: Introduce dmaengine support")
from Nov 16, 2023 (linux-next), leads to the following Smatch static
checker warning:

	drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1171 axienet_dma_rx_cb()
	error: 'app_metadata' dereferencing possible ERR_PTR()

drivers/net/ethernet/xilinx/xilinx_axienet_main.c
    1156 static void axienet_dma_rx_cb(void *data, const struct dmaengine_result *result)
    1157 {
    1158         struct skbuf_dma_descriptor *skbuf_dma;
    1159         size_t meta_len, meta_max_len, rx_len;
    1160         struct axienet_local *lp = data;
    1161         struct sk_buff *skb;
    1162         u32 *app_metadata;
    1163 
    1164         skbuf_dma = axienet_get_rx_desc(lp, lp->rx_ring_tail++);
    1165         skb = skbuf_dma->skb;
    1166         app_metadata = dmaengine_desc_get_metadata_ptr(skbuf_dma->desc, &meta_len,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
No error checking.

    1167                                                        &meta_max_len);
    1168         dma_unmap_single(lp->dev, skbuf_dma->dma_address, lp->max_frm_size,
    1169                          DMA_FROM_DEVICE);
    1170         /* TODO: Derive app word index programmatically */
--> 1171         rx_len = (app_metadata[LEN_APP] & 0xFFFF);
                           ^^^^^^^^^^^^
Dereference.

    1172         skb_put(skb, rx_len);
    1173         skb->protocol = eth_type_trans(skb, lp->ndev);
    1174         skb->ip_summed = CHECKSUM_NONE;
    1175 
    1176         __netif_rx(skb);
    1177         u64_stats_update_begin(&lp->rx_stat_sync);
    1178         u64_stats_add(&lp->rx_packets, 1);
    1179         u64_stats_add(&lp->rx_bytes, rx_len);
    1180         u64_stats_update_end(&lp->rx_stat_sync);
    1181         axienet_rx_submit_desc(lp->ndev);
    1182         dma_async_issue_pending(lp->rx_chan);
    1183 }

regards,
dan carpenter

             reply	other threads:[~2025-08-07 15:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 15:59 Dan Carpenter [this message]
2025-08-12 15:05 ` [bug report] net: axienet: Introduce dmaengine support Pandey, Radhey Shyam
  -- strict thread matches above, loose matches on Subject: below --
2023-11-27 12:57 Dan Carpenter
2023-11-29 14:46 ` Pandey, Radhey Shyam

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=aJTNZQBAuY83TN2h@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=radhey.shyam.pandey@amd.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.