From patchwork Fri Sep 18 23:13:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 48689 X-Patchwork-Delegate: dougsland@redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8IN60LV025889 for ; Fri, 18 Sep 2009 23:06:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758295AbZIRXF4 (ORCPT ); Fri, 18 Sep 2009 19:05:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757663AbZIRXF4 (ORCPT ); Fri, 18 Sep 2009 19:05:56 -0400 Received: from mail-ew0-f206.google.com ([209.85.219.206]:51400 "EHLO mail-ew0-f206.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757341AbZIRXFz (ORCPT ); Fri, 18 Sep 2009 19:05:55 -0400 Received: by ewy2 with SMTP id 2so1731048ewy.17 for ; Fri, 18 Sep 2009 16:05:58 -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=REatBxun0LMyYOo96mg2ziWQY4ju5yNaWvBGX6pn5fI=; b=hylBf/61uxOYGw9TzSMqpPwrUiv1tpwo3Pm2hmvlFSOEP6iXI2NhyarVH3AWdeZxsy +M8EnxZ41Eou3uHWc1/fV3DvHGEu996lFvAPiONNsniN1UqvnePToL7xsA0nf5kv+PA1 k1GafwjEnGeOT3xuj7uDCl/dLOcOoNNcqbs6A= 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=xBKF4JfGuaOeA4aZb5Z63dReJgweCWweTV3hHenk+IFChkVnJBeZ7lPS3zFiulFoKL Fs4u3Dt1tQ+WwME7Z2E6yxIrt7tcO0QMmi7aXVU7gxF8SAN68gKSEu3PVin+hOkhFPl/ gTmP4US1HRP5atbobLUAe5xRWHMdAbtxkwBbg= Received: by 10.216.22.70 with SMTP id s48mr670983wes.134.1253315157963; Fri, 18 Sep 2009 16:05:57 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 7sm898969eyg.4.2009.09.18.16.05.57 (version=SSLv3 cipher=RC4-MD5); Fri, 18 Sep 2009 16:05:57 -0700 (PDT) Message-ID: <4AB41406.6020106@gmail.com> Date: Sat, 19 Sep 2009 01:13:10 +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: Mauro Carvalho Chehab , linux-media@vger.kernel.org, Andrew Morton Subject: [PATCH] V4L/DVB (9367): kmalloc failure ignored in lgdt3304_attach() Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Prevent NULL dereference if kmalloc() fails. Signed-off-by: Roel Kluin --- Found with sed: http://kernelnewbies.org/roelkluin Build tested. -- To unsubscribe from this list: send the line "unsubscribe linux-media" 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/media/dvb/frontends/lgdt3304.c b/drivers/media/dvb/frontends/lgdt3304.c index eb72a98..e334b5d 100644 --- a/drivers/media/dvb/frontends/lgdt3304.c +++ b/drivers/media/dvb/frontends/lgdt3304.c @@ -363,6 +363,8 @@ struct dvb_frontend* lgdt3304_attach(const struct lgdt3304_config *config, struct lgdt3304_state *state; state = kzalloc(sizeof(struct lgdt3304_state), GFP_KERNEL); + if (state == NULL) + return NULL; state->addr = config->i2c_address; state->i2c = i2c; diff --git a/drivers/media/dvb/frontends/s921_module.c b/drivers/media/dvb/frontends/s921_module.c index 3f5a0e1..3156b64 100644 --- a/drivers/media/dvb/frontends/s921_module.c +++ b/drivers/media/dvb/frontends/s921_module.c @@ -169,6 +169,8 @@ struct dvb_frontend* s921_attach(const struct s921_config *config, struct s921_state *state; state = kzalloc(sizeof(struct s921_state), GFP_KERNEL); + if (state == NULL) + return NULL; state->addr = config->i2c_address; state->i2c = i2c;