RE: [bug report] net: axienet: Introduce dmaengine support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Sent: Monday, November 27, 2023 6:28 PM
> To: Pandey, Radhey Shyam <radhey.shyam.pandey@xxxxxxx>
> Cc: kernel-janitors@xxxxxxxxxxxxxxx
> Subject: [bug report] net: axienet: Introduce dmaengine support
> 
> Hello Radhey Shyam Pandey,
> 
> The patch 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:1060
> axienet_dma_rx_cb()
> 	error: 'app_metadata' dereferencing possible ERR_PTR()
> 
> drivers/net/ethernet/xilinx/xilinx_axienet_main.c
>     1045 static void axienet_dma_rx_cb(void *data, const struct
> dmaengine_result *result)
>     1046 {
>     1047         struct skbuf_dma_descriptor *skbuf_dma;
>     1048         size_t meta_len, meta_max_len, rx_len;
>     1049         struct axienet_local *lp = data;
>     1050         struct sk_buff *skb;
>     1051         u32 *app_metadata;
>     1052
>     1053         skbuf_dma = axienet_get_rx_desc(lp, lp->rx_ring_tail++);
>     1054         skb = skbuf_dma->skb;
>     1055         app_metadata =
> dmaengine_desc_get_metadata_ptr(skbuf_dma->desc, &meta_len,
>     1056                                                        &meta_max_len);
> 
> dmaengine_desc_get_metadata_ptr() can return error pointers

I will send out a patch to fix and add error handling for 
dmaengine_desc_get_metadata_ptr().

> 
>     1057         dma_unmap_single(lp->dev, skbuf_dma->dma_address, lp-
> >max_frm_size,
>     1058                          DMA_FROM_DEVICE);
>     1059         /* TODO: Derive app word index programmatically */
> --> 1060         rx_len = (app_metadata[LEN_APP] & 0xFFFF);
>                            ^^^^^^^^^^^^
> 
>     1061         skb_put(skb, rx_len);
>     1062         skb->protocol = eth_type_trans(skb, lp->ndev);
>     1063         skb->ip_summed = CHECKSUM_NONE;
>     1064
>     1065         __netif_rx(skb);
>     1066         u64_stats_update_begin(&lp->rx_stat_sync);
>     1067         u64_stats_add(&lp->rx_packets, 1);
>     1068         u64_stats_add(&lp->rx_bytes, rx_len);
>     1069         u64_stats_update_end(&lp->rx_stat_sync);
>     1070         axienet_rx_submit_desc(lp->ndev);
>     1071         dma_async_issue_pending(lp->rx_chan);
>     1072 }
> 
> regards,
> dan carpenter





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux