From patchwork Mon Aug 31 08:40:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 32614 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 397D3B7063 for ; Mon, 31 Aug 2009 18:34:49 +1000 (EST) Received: by ozlabs.org (Postfix) id 29BF3DDD0B; Mon, 31 Aug 2009 18:34:49 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id AAA5EDDD01 for ; Mon, 31 Aug 2009 18:34:48 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751436AbZHaIej (ORCPT ); Mon, 31 Aug 2009 04:34:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751302AbZHaIej (ORCPT ); Mon, 31 Aug 2009 04:34:39 -0400 Received: from mail-ew0-f206.google.com ([209.85.219.206]:56819 "EHLO mail-ew0-f206.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750878AbZHaIei (ORCPT ); Mon, 31 Aug 2009 04:34:38 -0400 Received: by ewy2 with SMTP id 2so85745ewy.17 for ; Mon, 31 Aug 2009 01:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=hy27BRZ+ThBl8iUTQM9ZafozrkBAc5xFWuX2hyMafDI=; b=sqd65JiqgFrOAs4b9OQCfh9knsLuxGI+P7FSjrvcgPmtQosT9FTnekAnmEep2UZHAF Wj2OIemqa0FHadCEXCG5cmwlFAHYKQPagU7mwOy4vYmmDf0tbDHNNLzX6U+TDz19y/Du 1+zMAtnRcgvqxHLHNsNzoLFBy6bg2cN9ZiP2k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=t3FZwTDwVo7V3fOExF4LmMp8JMzAEiYDo2AKiOIhz6CvZ67Ss6c/ansq0wne68BB4r 85Rh9w3wp2Zyoc7gZqm7NeqR1R2PXnZ36yhTYdL6Ge4RXWmGyiaLM/rtquITW9HrA+Q1 JTeXmf7qfxxfuTEL6qfsdiIBBmjD1OWlbbM14= Received: by 10.211.178.12 with SMTP id f12mr4135669ebp.29.1251707680028; Mon, 31 Aug 2009 01:34:40 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 7sm309942eyg.26.2009.08.31.01.34.39 (version=SSLv3 cipher=RC4-MD5); Mon, 31 Aug 2009 01:34:39 -0700 (PDT) Message-ID: <4A9B8C6F.3040503@gmail.com> Date: Mon, 31 Aug 2009 10:40:15 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3 MIME-Version: 1.0 To: netdev@vger.kernel.org, Andrew Morton , "David S. Miller" Subject: [PATCH] au1000_eth: possible NULL dereference of aup->mii_bus->irq in au1000_probe() Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org aup->mii_bus->irq allocation may fail, prevent a dereference of NULL. Signed-off-by: Roel Kluin Acked-by: Florian Fainelli --- -- 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/au1000_eth.c b/drivers/net/au1000_eth.c index d3c734f..02e4be0 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c @@ -1157,6 +1157,9 @@ static struct net_device * au1000_probe(int port_num) aup->mii_bus->name = "au1000_eth_mii"; snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%x", aup->mac_id); aup->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); + if (aup->mii_bus->irq == NULL) + goto err_out; + for(i = 0; i < PHY_MAX_ADDR; ++i) aup->mii_bus->irq[i] = PHY_POLL;