From patchwork Sat Mar 26 01:52:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 6212 Return-path: Envelope-to: mchehab@pedra Delivery-date: Sat, 26 Mar 2011 08:12:45 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1Q3RQD-0002j2-JV for mchehab@pedra; Sat, 26 Mar 2011 08:12:45 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Sat, 26 Mar 2011 08:12:45 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Q3IgW-0003JE-3I; Sat, 26 Mar 2011 01:53:00 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933591Ab1CZBw5 (ORCPT + 1 other); Fri, 25 Mar 2011 21:52:57 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:43264 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755665Ab1CZBw4 (ORCPT ); Fri, 25 Mar 2011 21:52:56 -0400 Received: by iwn34 with SMTP id 34so1649208iwn.19 for ; Fri, 25 Mar 2011 18:52:56 -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=viIiWzFPgc2oIwViusfXoKOPiUPPAJoi7zQ/L5z41LQ=; b=fdfmvJdnvzAakEDJ/LROjWHONXl7uoU5RjKkygSyKR2VcDERow9BGn3/SJvVXRy0vW A7WPYIiRjnnwbl5o3hSwvluuhB8tTKYat2flQkbtLjRbYXxBAOgUIaIu9MBZhdBqYBtB b6dfWdZsqNx83J0TX/IfZ3uKuG/7e71FYgGhU= 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=wDzFKZfrnKpVIDb7NNgXtk5+1p2k0kBaYnbtcbHmTawp5QX8nqmktolAPB95aqe616 3YAI++hvXH2ZM7Uik2+v3yZN6CHSjpcL4i25ZFLgOio0SMqsDe9JfEdm6WJJGqjkc2a6 FOdNlMONEaCfxNktWYJLil2HlDsc/RVK/oAkk= Received: by 10.42.159.201 with SMTP id m9mr2363938icx.244.1301104376251; Fri, 25 Mar 2011 18:52:56 -0700 (PDT) Received: from bicker ([212.49.88.34]) by mx.google.com with ESMTPS id u9sm1022656ibe.36.2011.03.25.18.52.49 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Mar 2011 18:52:55 -0700 (PDT) Date: Sat, 26 Mar 2011 04:52:22 +0300 From: Dan Carpenter To: Mike Isely Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 3/6] [media] pvrusb2: check for allocation failures Message-ID: <20110326015221.GH2008@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: This function returns NULL on failure so lets do that if kzalloc() fails. There is a separate problem that the caller for this function doesn't check for errors... Signed-off-by: Dan Carpenter Acked-By: Mike Isely --- 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/pvrusb2/pvrusb2-std.c b/drivers/media/video/pvrusb2/pvrusb2-std.c index 370a9ab..b214f77 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-std.c +++ b/drivers/media/video/pvrusb2/pvrusb2-std.c @@ -388,6 +388,9 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr, stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt, GFP_KERNEL); + if (!stddefs) + return NULL; + for (idx = 0; idx < std_cnt; idx++) stddefs[idx].index = idx;