All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <error27@gmail.com>
Cc: Joe Perches <joe@perches.com>,
	Lennert Buytenhek <buytenh@wantstofly.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jiri Pirko <jpirko@redhat.com>,
	Denis Kirjanov <kirjanov@gmail.com>,
	Saeed Bishara <saeed@marvell.com>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch -next v2] mv643xx_eth: potential null dereference
Date: Fri, 23 Jul 2010 16:30:22 +0000	[thread overview]
Message-ID: <4C49C39E.8020502@bfs.de> (raw)
In-Reply-To: <20100723110504.GG26313@bicker>



Dan Carpenter schrieb:
> We assume that "pd" can be null on the previous line, and throughout the
> function so we should check it here as well.  This was introduced by
> 9b2c2ff7a1c0 "mv643xx_eth: use sw csum for big packets"
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> v2: style change
> 
> diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
> index 73bb8ea..f5e72fe 100644
> --- a/drivers/net/mv643xx_eth.c
> +++ b/drivers/net/mv643xx_eth.c
> @@ -2670,7 +2670,8 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
>  	 * Detect hardware parameters.
>  	 */
>  	msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000;
> -	msp->tx_csum_limit = pd->tx_csum_limit ? pd->tx_csum_limit : 9 * 1024;
> +	msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
> +					pd->tx_csum_limit : 9 * 1024;
>  	infer_hw_params(msp);
>  
>  	platform_set_drvdata(pdev, msp);

this is a bit complicated, IMHO ppl have a bigger chance to discover what is going on
with this version:

    if (!pd ) {
       msp->t_clk = 133000000;
       msp->tx_csum_limit = 9 * 1024;
     }
     else
      {
	msp->t_clk = pd->t_clk ? pd->t_clk : 133000000 ;
        msp->tx_csum_limit = pd->tx_csum_limit ? pd->tx_csum_limit : 9 * 1024;
       }


re,
 wh








WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <error27@gmail.com>
Cc: Joe Perches <joe@perches.com>,
	Lennert Buytenhek <buytenh@wantstofly.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jiri Pirko <jpirko@redhat.com>,
	Denis Kirjanov <kirjanov@gmail.com>,
	Saeed Bishara <saeed@marvell.com>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch -next v2] mv643xx_eth: potential null dereference
Date: Fri, 23 Jul 2010 18:30:22 +0200	[thread overview]
Message-ID: <4C49C39E.8020502@bfs.de> (raw)
In-Reply-To: <20100723110504.GG26313@bicker>



Dan Carpenter schrieb:
> We assume that "pd" can be null on the previous line, and throughout the
> function so we should check it here as well.  This was introduced by
> 9b2c2ff7a1c0 "mv643xx_eth: use sw csum for big packets"
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> v2: style change
> 
> diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
> index 73bb8ea..f5e72fe 100644
> --- a/drivers/net/mv643xx_eth.c
> +++ b/drivers/net/mv643xx_eth.c
> @@ -2670,7 +2670,8 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
>  	 * Detect hardware parameters.
>  	 */
>  	msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000;
> -	msp->tx_csum_limit = pd->tx_csum_limit ? pd->tx_csum_limit : 9 * 1024;
> +	msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
> +					pd->tx_csum_limit : 9 * 1024;
>  	infer_hw_params(msp);
>  
>  	platform_set_drvdata(pdev, msp);

this is a bit complicated, IMHO ppl have a bigger chance to discover what is going on
with this version:

    if (!pd ) {
       msp->t_clk = 133000000;
       msp->tx_csum_limit = 9 * 1024;
     }
     else
      {
	msp->t_clk = pd->t_clk ? pd->t_clk : 133000000 ;
        msp->tx_csum_limit = pd->tx_csum_limit ? pd->tx_csum_limit : 9 * 1024;
       }


re,
 wh








  parent reply	other threads:[~2010-07-23 16:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 10:15 [patch -next] mv643xx_eth: potential null dereference Dan Carpenter
2010-07-23 10:15 ` Dan Carpenter
2010-07-23 10:32 ` Joe Perches
2010-07-23 10:32   ` Joe Perches
2010-07-23 11:05   ` [patch -next v2] " Dan Carpenter
2010-07-23 11:05     ` Dan Carpenter
2010-07-23 11:18     ` Lennert Buytenhek
2010-07-23 11:18       ` Lennert Buytenhek
2010-07-23 20:05       ` David Miller
2010-07-23 20:05         ` David Miller
2010-07-23 16:30     ` walter harms [this message]
2010-07-23 16:30       ` walter harms
2010-07-23 22:15       ` Dan Carpenter
2010-07-23 22:15         ` Dan Carpenter
2010-07-24  8:59         ` walter harms
2010-07-24  8:59           ` walter harms
2010-07-24 19:00           ` Lennert Buytenhek
2010-07-24 19:00             ` Lennert Buytenhek
2010-07-25 14:47             ` walter harms
2010-07-25 14:47               ` walter harms
2010-07-25 15:54               ` Lennert Buytenhek
2010-07-25 15:54                 ` Lennert Buytenhek

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=4C49C39E.8020502@bfs.de \
    --to=wharms@bfs.de \
    --cc=buytenh@wantstofly.org \
    --cc=davem@davemloft.net \
    --cc=error27@gmail.com \
    --cc=joe@perches.com \
    --cc=jpirko@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kirjanov@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeed@marvell.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.