netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Marek Vasut <marex@denx.de>
Cc: netdev@vger.kernel.org, f.fainelli@gmail.com,
	Tristram Ha <Tristram.Ha@microchip.com>,
	Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
	Woojung Huh <woojung.huh@microchip.com>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH V2 2/3] net: dsa: ksz: Factor out common tag code
Date: Fri, 14 Dec 2018 10:05:25 +0100	[thread overview]
Message-ID: <20181214090525.GA5513@lunn.ch> (raw)
In-Reply-To: <20181213160159.18956-3-marex@denx.de>

> +static struct sk_buff *ksz_common_xmit(struct sk_buff *skb,
> +				       struct net_device *dev, int len)
>  {
> -	struct dsa_port *dp = dsa_slave_to_port(dev);
>  	struct sk_buff *nskb;
>  	int padlen;
> -	u8 *tag;
>  
>  	padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len;
>  
> -	if (skb_tailroom(skb) >= padlen + KSZ_INGRESS_TAG_LEN) {
> +	if (skb_tailroom(skb) >= padlen + len) {
>  		/* Let dsa_slave_xmit() free skb */
>  		if (__skb_put_padto(skb, skb->len + padlen, false))
>  			return NULL;

Hi Marek

This can return NULL.

> +static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
> +				    struct net_device *dev)
> +{
> +	struct dsa_port *dp = dsa_slave_to_port(dev);
> +	struct sk_buff *nskb;
> +	u16 *tag;
> +	u8 *addr;
> +
> +	nskb = ksz_common_xmit(skb, dev, KSZ9477_INGRESS_TAG_LEN);

So here you need to check for NULL

Otherwise, i like it. Thanks for removing the function pointer.

	   Andrew

  reply	other threads:[~2018-12-14  9:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 16:01 [PATCH V2 0/3] net: dsa: ksz: Clean up the tag code in prep for more switches Marek Vasut
2018-12-13 16:01 ` [PATCH V2 1/3] net: dsa: ksz: Rename NET_DSA_TAG_KSZ to _KSZ9477 Marek Vasut
2018-12-14  8:42   ` Andrew Lunn
2018-12-13 16:01 ` [PATCH V2 2/3] net: dsa: ksz: Factor out common tag code Marek Vasut
2018-12-14  9:05   ` Andrew Lunn [this message]
2018-12-14 13:30     ` Marek Vasut
2018-12-14 20:11       ` Andrew Lunn
2018-12-15  0:39         ` Marek Vasut
2018-12-13 16:01 ` [PATCH V2 3/3] net: dsa: ksz: Add STP multicast handling Marek Vasut
2018-12-14  9:07   ` Andrew Lunn

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=20181214090525.GA5513@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Tristram.Ha@microchip.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=marex@denx.de \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    --cc=woojung.huh@microchip.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 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).