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>
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 1170798..57abe33 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -1407,6 +1407,8 @@
return -EINVAL;
ap_buffer = kmalloc((num_bufs * sizeof(u8 *)), GFP_KERNEL);
+ if (ap_buffer == NULL)
+ return -ENOMEM;
status = strm_allocate_buffer(args->args_strm_allocatebuffer.hstream,
args->args_strm_allocatebuffer.usize,
@@ -1446,6 +1448,8 @@
return -EINVAL;
ap_buffer = kmalloc((num_bufs * sizeof(u8 *)), GFP_KERNEL);
+ if (ap_buffer == NULL)
+ return -ENOMEM;
CP_FM_USR(ap_buffer, args->args_strm_freebuffer.ap_buffer, status,
num_bufs);