From patchwork Thu Jun 9 07:09:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 863472 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p597A6Jv011791 for ; Thu, 9 Jun 2011 07:10:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755228Ab1FIHKB (ORCPT ); Thu, 9 Jun 2011 03:10:01 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:55720 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752569Ab1FIHKA (ORCPT ); Thu, 9 Jun 2011 03:10:00 -0400 Received: by pwi15 with SMTP id 15so607319pwi.19 for ; Thu, 09 Jun 2011 00:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=obzJcsHNVHioGhBoUwIux3OuY/dwbX5FdusDmXDgxu0=; b=m3GVe/kQUpQ2F46jc51Cfq9COTysRMK9L4odODoW3/MzqHOiQKskmxtwWo2codF3aU Z7yjR+0PXq/DBWTMtnvMwtFg9niC/KIzWvFuPtEc6uWCUBgGZ9z7FBIKttBUPiMks8LD xIyP7oUBbY+GdyRNF5Bdi2tFQHuOAIRC5NvnI= 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=Lr5JYbWuKzOTaG+GQunMTpWl4pfjbCZ7bg1E6GEdjSNKOTxQSdUraKoMZxIEtqC05N +oMrRejjWvWfzc0vyWIjJObQf/aAfEF5Bmnyh9nu2AFT47DliA23lZiZZ11g4eAj+qlG 1rHSnD2t+FEszB/RymMfI9OqtJH53nRlkXJeY= Received: by 10.143.21.28 with SMTP id y28mr56179wfi.211.1307603399785; Thu, 09 Jun 2011 00:09:59 -0700 (PDT) Received: from shale.localdomain ([41.139.221.94]) by mx.google.com with ESMTPS id o1sm1431747wfd.8.2011.06.09.00.09.55 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Jun 2011 00:09:58 -0700 (PDT) Date: Thu, 9 Jun 2011 10:09:34 +0300 From: Dan Carpenter To: Stefano Brivio Cc: "John W. Linville" , "open list:B43 WIRELESS DRIVER" , kernel-janitors@vger.kernel.org Subject: [patch] b43: check for allocation failures Message-ID: <20110609070934.GE4069@shale.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 09 Jun 2011 07:10:06 +0000 (UTC) Add some error handling if the allocation fails. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c index 6c63aec..8a10b82 100644 --- a/drivers/net/wireless/b43/bus.c +++ b/drivers/net/wireless/b43/bus.c @@ -83,7 +83,11 @@ void b43_bus_ssb_block_write(struct b43_bus_dev *dev, const void *buffer, struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) { - struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL); + struct b43_bus_dev *dev; + + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (!dev) + return NULL; dev->bus_type = B43_BUS_SSB; dev->sdev = sdev; diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index cae3146..c8131a0 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c @@ -5025,6 +5025,8 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) int first = 0; dev = b43_bus_dev_ssb_init(sdev); + if (!dev) + return -ENOMEM; wl = ssb_get_devtypedata(sdev); if (!wl) {