From patchwork Fri Jul 23 10:15:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 59762 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E4D0C100A69 for ; Fri, 23 Jul 2010 20:16:30 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756484Ab0GWKQA (ORCPT ); Fri, 23 Jul 2010 06:16:00 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:50110 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756333Ab0GWKP5 (ORCPT ); Fri, 23 Jul 2010 06:15:57 -0400 Received: by fxm14 with SMTP id 14so4901534fxm.19 for ; Fri, 23 Jul 2010 03:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=1rHrZ4eDwyn1h2S26RM77/NoUQWvVndGB0rVC+Hv/RA=; b=CgngNCsV/KA2qucuAPfcvrHe0WZOFnBGS+c0LQlpKODRf/CaZvSYj3VbgjzqFWwbg1 6v1b9Fk4DnP/NYzjwE/dlSq5EWXVTTA9hhKQpyBjEoOL31QuBTtLl0IDm1m5FdIxyOnq MarZM49ApBAKmzZ50YRnUVgNpyTgLepDNTSw4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=TYow4zefISVaah9+c86c1MqOOdIExgq4gU54jlCqcxQ4MJC2zXQuK8wFSQkebX6qVK sAs7ED07TFH3cn18g3JTAj9EwzptpPlT6nAwJKLtmuF3n3OlzBJWhVuJeGnxJUbpBfGN dxsKa+0k53yMmsWK8SDq0sxxCW4wMVebCABA8= Received: by 10.86.59.2 with SMTP id h2mr2506937fga.40.1279880156036; Fri, 23 Jul 2010 03:15:56 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id w11sm28354fao.37.2010.07.23.03.15.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 23 Jul 2010 03:15:54 -0700 (PDT) Date: Fri, 23 Jul 2010 12:15:28 +0200 From: Dan Carpenter To: Lennert Buytenhek Cc: "David S. Miller" , Jiri Pirko , Denis Kirjanov , Saeed Bishara , netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch -next] mv643xx_eth: potential null dereference Message-ID: <20100723101528.GF26313@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 2fcdb1e..9166f55 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c @@ -2675,7 +2675,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 && pd->tx_csum_limit) ? + pd->tx_csum_limit : 9 * 1024; infer_hw_params(msp); platform_set_drvdata(pdev, msp);