Message ID | 20110326015221.GH2008@bicker (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-path: <mchehab@pedra> 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 <mchehab@pedra>) 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 <mchehab@localhost> (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 <rfc822;kmpark@infradead.org> + 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 <rfc822;linux-media@vger.kernel.org>); Fri, 25 Mar 2011 21:52:56 -0400 Received: by iwn34 with SMTP id 34so1649208iwn.19 for <multiple recipients>; 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 <error27@gmail.com> To: Mike Isely <isely@pobox.com> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>, 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-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org Sender: <mchehab@pedra> |
Commit Message
Dan Carpenter
March 26, 2011, 1:52 a.m. UTC
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 <error27@gmail.com>
--
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
Comments
Acked-By: Mike Isely <isely@pobox.com> On Sat, 26 Mar 2011, Dan Carpenter wrote: > 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 <error27@gmail.com> > > 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; > >
On Fri, Mar 25, 2011 at 11:33:36PM -0500, Mike Isely wrote: > > Acked-By: Mike Isely <isely@pobox.com> > I'd need to reformat this one to get it to apply... :/ It doesn't actually fix the bug so it's not worth it. regards, dan carpenter -- 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
I'll look at the surrounding code and see what makes sense there. Having an error leg for allocation failures is a useful thing. -Mike Dan Carpenter wrote: > On Fri, Mar 25, 2011 at 11:33:36PM -0500, Mike Isely wrote: > >> Acked-By: Mike Isely <isely@pobox.com> >> >> > > I'd need to reformat this one to get it to apply... :/ It doesn't > actually fix the bug so it's not worth it. > > regards, > dan carpenter > -- > 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;