From admin at mashintop.ru Wed Aug 3 22:31:43 2022 From: admin at mashintop.ru (kupiavtonomer.org) Date: Thu, 04 Aug 2022 05:31:43 +0000 Subject: =?utf-8?Q?=D0=94=D0=BE=D0=B1=D1=80=D0=BE_=D0=BF=D0=BE?= =?utf-8?Q?=D0=B6=D0=B0=D0=BB=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=2C?= BITCOIN WILL MAKE YOU A BILLIONAIRE >>> https://telegra.ph/Cryptocurrency-makes-people-millionaires-at-15-people-per-hour---Page-690242-08-02 << ????????????, BITCOIN WILL MAKE YOU A BILLIONAIRE >>> https://telegra.ph/Cryptocurrency-makes-people-millionaires-at-15-people-per-hour---Page-690242-08-02 << 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 From robdclark at gmail.com Thu Aug 25 09:28:49 2022 From: robdclark at gmail.com (Rob Clark) Date: Thu, 25 Aug 2022 09:28:49 -0700 Subject: [bug report] wcn36xx: check dma_mapping_error() In-Reply-To: References: Message-ID: On Thu, Aug 25, 2022 at 9:10 AM Dan Carpenter wrote: > > 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. judging by the date, it was probably on a 32b system ;-) that said, it doesn't seem like that code even supports systems w/ 64b dma addr BR, -R > > 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