From patchwork Fri Sep 18 23:10:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 48687 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 n8IN3YQr025678 for ; Fri, 18 Sep 2009 23:03:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758821AbZIRXDN (ORCPT ); Fri, 18 Sep 2009 19:03:13 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758744AbZIRXDN (ORCPT ); Fri, 18 Sep 2009 19:03:13 -0400 Received: from ey-out-2122.google.com ([74.125.78.26]:2238 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758704AbZIRXDM (ORCPT ); Fri, 18 Sep 2009 19:03:12 -0400 Received: by ey-out-2122.google.com with SMTP id 4so226419eyf.5 for ; Fri, 18 Sep 2009 16:03:15 -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=g3R3sDT7bjTlzENTRF+xWoj6PYXpex6xqZqML0MO+T4=; b=f7IprF8opKqqsRvu40NF8QrF//UOaxGqemNp+2g9C1CRPeY0Og5dRHvq4F2Yk+j1x7 /ohZt99uaJ/Uwawcfe97tD+vKNWfDGrPuA08m0N9jKeHCMrnYBr6FGOFD734bH2Irzn5 ZzldTo1cp/9VSfg5uLQ6tNGP2euUuPPndkJCo= 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=dB/+5h4JcUAeB8wPesoYEfBGLaJk0VgOx8UmpYu69cYF6stthjFVWU1OspVxg++Tq0 PAoeTDs0RwupA0wb9Us2T15+iQWGFB3Ok9CfMuYgvrtqN9TpP1SB0mC4D5c9x8Wc/NoI mCNY5emnDiX0PYOFTUQNovqFrOrMZ/VqarKKY= Received: by 10.211.142.11 with SMTP id u11mr2704304ebn.8.1253314995630; Fri, 18 Sep 2009 16:03:15 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 24sm1628293eyx.7.2009.09.18.16.03.14 (version=SSLv3 cipher=RC4-MD5); Fri, 18 Sep 2009 16:03:15 -0700 (PDT) Message-ID: <4AB41364.20106@gmail.com> Date: Sat, 19 Sep 2009 01:10:28 +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 (7969): kmalloc failure ignored in m920x_firmware_download() 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/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index aec7a19..ef9b7be 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c @@ -337,6 +337,8 @@ static int m920x_firmware_download(struct usb_device *udev, const struct firmwar int i, pass, ret = 0; buff = kmalloc(65536, GFP_KERNEL); + if (buff == NULL) + return -ENOMEM; if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) goto done;