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

staging: tidspbridge: check kmalloc() result

If kmalloc() fails then exit with -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Kulikov Vasiliy and committed by
Greg Kroah-Hartman
dd85c991 4018e396

+4
+4
drivers/staging/tidspbridge/pmgr/dspapi.c
··· 1407 1407 return -EINVAL; 1408 1408 1409 1409 ap_buffer = kmalloc((num_bufs * sizeof(u8 *)), GFP_KERNEL); 1410 + if (ap_buffer == NULL) 1411 + return -ENOMEM; 1410 1412 1411 1413 status = strm_allocate_buffer(args->args_strm_allocatebuffer.hstream, 1412 1414 args->args_strm_allocatebuffer.usize, ··· 1448 1446 return -EINVAL; 1449 1447 1450 1448 ap_buffer = kmalloc((num_bufs * sizeof(u8 *)), GFP_KERNEL); 1449 + if (ap_buffer == NULL) 1450 + return -ENOMEM; 1451 1451 1452 1452 CP_FM_USR(ap_buffer, args->args_strm_freebuffer.ap_buffer, status, 1453 1453 num_bufs);