Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] 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...

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-By: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Dan Carpenter and committed by
Mauro Carvalho Chehab
0cff5937 ce02704d

+5 -1
+5 -1
drivers/media/video/pvrusb2/pvrusb2-std.c
··· 370 370 371 371 stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt, 372 372 GFP_KERNEL); 373 - for (idx = 0; idx < std_cnt; idx++) stddefs[idx].index = idx; 373 + if (!stddefs) 374 + return NULL; 375 + 376 + for (idx = 0; idx < std_cnt; idx++) 377 + stddefs[idx].index = idx; 374 378 375 379 idx = 0; 376 380