pvrusb2: check for allocation failures
Subsystems (2)
PATCH 3/6 pvrusb2: check for allocation failures
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...
drivers/media/video/pvrusb2/pvrusb2-std.c +3 -0
@@ -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;
Quoted 21 lines · Dan Carpenter
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 <[email protected]>drivers/media/video/pvrusb2/pvrusb2-std.c +3
-0@@ -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;
Signature · 3 lines
Mike Isely isely @ isely (dot) net PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8
Quoted 3 lines · Mike Isely
Acked-by Mike Isely <[email protected]>
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
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
Quoted 16 lines · Dan Carpenter
Quoted 3 lines · Mike Isely
Acked-by Mike Isely <[email protected]>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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Mike Isely isely @ isely (dot) net PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8