From: Dan Carpenter <dan.carpenter@oracle.com>
To: robdclark@gmail.com
Cc: wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org
Subject: [bug report] wcn36xx: check dma_mapping_error()
Date: Thu, 25 Aug 2022 19:10:12 +0300 [thread overview]
Message-ID: <Ywee5H+m/4Y5lXq4@kili> (raw)
Hello Rob Clark,
The patch 4165cf7ba52a: "wcn36xx: check dma_mapping_error()" from Jul
3, 2017, leads to the following Smatch static checker warning:
drivers/net/wireless/ath/wcn36xx/dxe.c:305 wcn36xx_dxe_fill_skb()
warn: 'dxe->dst_addr_l' is not a DMA mapping error
drivers/net/wireless/ath/wcn36xx/dxe.c:805 wcn36xx_dxe_tx_frame()
warn: 'desc_skb->src_addr_l' is not a DMA mapping error
drivers/net/wireless/ath/wcn36xx/dxe.c
290 static int wcn36xx_dxe_fill_skb(struct device *dev,
291 struct wcn36xx_dxe_ctl *ctl,
292 gfp_t gfp)
293 {
294 struct wcn36xx_dxe_desc *dxe = ctl->desc;
295 struct sk_buff *skb;
296
297 skb = alloc_skb(WCN36XX_PKT_SIZE, gfp);
298 if (skb == NULL)
299 return -ENOMEM;
300
301 dxe->dst_addr_l = dma_map_single(dev,
302 skb_tail_pointer(skb),
303 WCN36XX_PKT_SIZE,
304 DMA_FROM_DEVICE);
--> 305 if (dma_mapping_error(dev, dxe->dst_addr_l)) {
I'm so surprised that adding this check fixed a bug. There is an
addr_l and addr_h (presumably for the low and high bits of the address?)
The ->dst_addr_h is never used.
A 32bit dst_addr_l can't be equal to DMA_MAPPING_ERROR unless it's a 32
bit system-ish.
306 dev_err(dev, "unable to map skb\n");
307 kfree_skb(skb);
308 return -ENOMEM;
309 }
310 ctl->skb = skb;
311
312 return 0;
313 }
regards,
dan carpenter
next reply other threads:[~2022-08-25 16:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 16:10 Dan Carpenter [this message]
2022-08-25 16:28 ` [bug report] wcn36xx: check dma_mapping_error() Rob Clark
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=Ywee5H+m/4Y5lXq4@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-wireless@vger.kernel.org \
--cc=robdclark@gmail.com \
--cc=wcn36xx@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox