[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4C49C39E.8020502@bfs.de>
Date: Fri, 23 Jul 2010 18:30:22 +0200
From: walter harms <wharms@....de>
To: Dan Carpenter <error27@...il.com>
CC: Joe Perches <joe@...ches.com>,
Lennert Buytenhek <buytenh@...tstofly.org>,
"David S. Miller" <davem@...emloft.net>,
Jiri Pirko <jpirko@...hat.com>,
Denis Kirjanov <kirjanov@...il.com>,
Saeed Bishara <saeed@...vell.com>, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [patch -next v2] mv643xx_eth: potential null dereference
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@...il.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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists