public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/6] [media] pvrusb2: check for allocation failures
@ 2011-03-26  1:52 Dan Carpenter
  2011-03-26  4:33 ` Mike Isely
  0 siblings, 1 reply; 4+ 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] 4+ messages in thread

* Re: [PATCH 3/6] [media] pvrusb2: check for allocation failures
  2011-03-26  1:52 [PATCH 3/6] [media] pvrusb2: check for allocation failures Dan Carpenter
@ 2011-03-26  4:33 ` Mike Isely
  2011-03-26  6:48   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Isely @ 2011-03-26  4:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors, Mike Isely


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;
>  
> 

-- 

Mike Isely
isely @ isely (dot) net
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8

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

* Re: [PATCH 3/6] [media] pvrusb2: check for allocation failures
  2011-03-26  4:33 ` Mike Isely
@ 2011-03-26  6:48   ` Dan Carpenter
  2011-03-26 18:07     ` Mike Isely
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-03-26  6:48 UTC (permalink / raw)
  To: Mike Isely; +Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors

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

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

* Re: [PATCH 3/6] [media] pvrusb2: check for allocation failures
  2011-03-26  6:48   ` Dan Carpenter
@ 2011-03-26 18:07     ` Mike Isely
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Isely @ 2011-03-26 18:07 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors, isely

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
>   


-- 

Mike Isely
isely @ isely (dot) net
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8


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

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

Thread overview: 4+ 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  4:33 ` Mike Isely
2011-03-26  6:48   ` Dan Carpenter
2011-03-26 18:07     ` Mike Isely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox