Commit 50a749c1f2fc8f03232c174c9dbc78a78f9bebfd

Authored by Dan Carpenter
Committed by David S. Miller
1 parent f89f5d0e94

mv643xx_eth: potential null dereference

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>
Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

drivers/net/mv643xx_eth.c
... ... @@ -2675,7 +2675,8 @@
2675 2675 * Detect hardware parameters.
2676 2676 */
2677 2677 msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000;
2678   - msp->tx_csum_limit = pd->tx_csum_limit ? pd->tx_csum_limit : 9 * 1024;
  2678 + msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
  2679 + pd->tx_csum_limit : 9 * 1024;
2679 2680 infer_hw_params(msp);
2680 2681  
2681 2682 platform_set_drvdata(pdev, msp);