From patchwork Fri Sep 18 23:17:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 48690 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 n8INAiwI026431 for ; Fri, 18 Sep 2009 23:10:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758295AbZIRXKj (ORCPT ); Fri, 18 Sep 2009 19:10:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757701AbZIRXKj (ORCPT ); Fri, 18 Sep 2009 19:10:39 -0400 Received: from ey-out-2122.google.com ([74.125.78.26]:25393 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757341AbZIRXKj (ORCPT ); Fri, 18 Sep 2009 19:10:39 -0400 Received: by ey-out-2122.google.com with SMTP id d26so107417eyd.19 for ; Fri, 18 Sep 2009 16:10:42 -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=OqIyUEA//kk1ZJTVFQ3U7cLWQE0eE6g09PRLccYlnuA=; b=CmMJ+Lkq4g+RDQ80+9MnHdK1fbGQBs+y4Xoa/R15TlmV3ctVhdA9Jtcn4OUPxjLuIX bHNdGjZCoFdC9x7bBN7TtVbE75rM4pGrXyfB/1JmkEjD6ujNzlYQtUooiVTJrZD2v5EC ijzkMGoANM0ance4aydFKm+iwHJ6Ordb4dce8= 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=tZbDx1mmUXtakBMcVaeb5pVORznFX3+cnCylvjMPG0HE1WRf+UN/wh9BqpMp2QP4Ol Cslzhn3h5ZFhoyA9Yo/AsTsCA/GD0TzHJz0UT3FYoU4aI/yYk4paOw4mqqinNe/QK5mQ TcRr39xcBtdySvgjII8I+n0Y7LVZNyDTNK28M= Received: by 10.211.155.16 with SMTP id h16mr2714387ebo.55.1253315441971; Fri, 18 Sep 2009 16:10:41 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 7sm1399299eyb.20.2009.09.18.16.10.41 (version=SSLv3 cipher=RC4-MD5); Fri, 18 Sep 2009 16:10:41 -0700 (PDT) Message-ID: <4AB41522.5080204@gmail.com> Date: Sat, 19 Sep 2009 01:17:54 +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: Jean-Francois Moine , linux-media@vger.kernel.org, Andrew Morton Subject: [PATCH] GSPCA: kmalloc failure ignored in sd_start() 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 -- 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/video/gspca/jeilinj.c b/drivers/media/video/gspca/jeilinj.c index dbfa3ed..a11c97e 100644 --- a/drivers/media/video/gspca/jeilinj.c +++ b/drivers/media/video/gspca/jeilinj.c @@ -312,6 +312,8 @@ static int sd_start(struct gspca_dev *gspca_dev) /* create the JPEG header */ dev->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL); + if (dev->jpeg_hdr == NULL) + return -ENOMEM; jpeg_define(dev->jpeg_hdr, gspca_dev->height, gspca_dev->width, 0x21); /* JPEG 422 */ jpeg_set_qual(dev->jpeg_hdr, dev->quality);