All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/6] [media] pvrusb2: check for allocation failures
@ 2011-03-26  1:52 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2011-03-26  1:52 UTC (permalink / raw)
  To: Mike Isely; +Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors

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;
 

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-03-26 18:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-26  1:52 [PATCH 3/6] [media] pvrusb2: check for allocation failures Dan Carpenter
2011-03-26  1:52 ` Dan Carpenter
2011-03-26  4:33 ` Mike Isely
2011-03-26  4:33   ` Mike Isely
2011-03-26  6:48   ` Dan Carpenter
2011-03-26  6:48     ` Dan Carpenter
2011-03-26 18:07     ` Mike Isely
2011-03-26 18:07       ` Mike Isely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.