netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] net: airoha: Move DSA tag in DMA descriptor
@ 2025-03-06  9:49 Dan Carpenter
  2025-03-06 10:21 ` Lorenzo Bianconi
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-03-06  9:49 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: netdev

Hello Lorenzo Bianconi,

Commit af3cf757d5c9 ("net: airoha: Move DSA tag in DMA descriptor")
from Feb 28, 2025 (linux-next), leads to the following Smatch static
checker warning:

	drivers/net/ethernet/airoha/airoha_eth.c:1722 airoha_get_dsa_tag()
	warn: 'dp' isn't an ERR_PTR

drivers/net/ethernet/airoha/airoha_eth.c
    1710 static u32 airoha_get_dsa_tag(struct sk_buff *skb, struct net_device *dev)
    1711 {
    1712 #if IS_ENABLED(CONFIG_NET_DSA)
    1713         struct ethhdr *ehdr;
    1714         struct dsa_port *dp;
    1715         u8 xmit_tpid;
    1716         u16 tag;
    1717 
    1718         if (!netdev_uses_dsa(dev))
    1719                 return 0;
    1720 
    1721         dp = dev->dsa_ptr;
--> 1722         if (IS_ERR(dp))

Why would this be an error pointer?  Is this supposed to be a check for
NULL?

    1723                 return 0;
    1724 
    1725         if (dp->tag_ops->proto != DSA_TAG_PROTO_MTK)
    1726                 return 0;
    1727 
    1728         if (skb_cow_head(skb, 0))
    1729                 return 0;
    1730 

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] net: airoha: Move DSA tag in DMA descriptor
  2025-03-06  9:49 [bug report] net: airoha: Move DSA tag in DMA descriptor Dan Carpenter
@ 2025-03-06 10:21 ` Lorenzo Bianconi
  0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Bianconi @ 2025-03-06 10:21 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 1395 bytes --]

On Mar 06, Dan Carpenter wrote:
> Hello Lorenzo Bianconi,
> 
> Commit af3cf757d5c9 ("net: airoha: Move DSA tag in DMA descriptor")
> from Feb 28, 2025 (linux-next), leads to the following Smatch static
> checker warning:
> 
> 	drivers/net/ethernet/airoha/airoha_eth.c:1722 airoha_get_dsa_tag()
> 	warn: 'dp' isn't an ERR_PTR
> 
> drivers/net/ethernet/airoha/airoha_eth.c
>     1710 static u32 airoha_get_dsa_tag(struct sk_buff *skb, struct net_device *dev)
>     1711 {
>     1712 #if IS_ENABLED(CONFIG_NET_DSA)
>     1713         struct ethhdr *ehdr;
>     1714         struct dsa_port *dp;
>     1715         u8 xmit_tpid;
>     1716         u16 tag;
>     1717 
>     1718         if (!netdev_uses_dsa(dev))
>     1719                 return 0;
>     1720 
>     1721         dp = dev->dsa_ptr;
> --> 1722         if (IS_ERR(dp))
> 
> Why would this be an error pointer?  Is this supposed to be a check for
> NULL?

yes, right. Moreover NULL pointer check is already done in netdev_uses_dsa() so
we can drop it. I will post a fix for it.

Regards,
Lorenzo

> 
>     1723                 return 0;
>     1724 
>     1725         if (dp->tag_ops->proto != DSA_TAG_PROTO_MTK)
>     1726                 return 0;
>     1727 
>     1728         if (skb_cow_head(skb, 0))
>     1729                 return 0;
>     1730 
> 
> regards,
> dan carpenter

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-06 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06  9:49 [bug report] net: airoha: Move DSA tag in DMA descriptor Dan Carpenter
2025-03-06 10:21 ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).