Skip to contentSkip to conversation

staging: tidspbridge: check kmalloc() result

PATCH Applied Kulikov Vasiliy 1 participant 1 message Jul 16, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 6/15 staging: tidspbridge: check kmalloc() result

If kmalloc() fails then exit with -ENOMEM.

---
 drivers/staging/tidspbridge/pmgr/dspapi.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/staging/tidspbridge/pmgr/dspapi.c +4 -0
index 7597210..ba5d8c4 100644
@@ -1407,6 +1407,8 @@ u32 strmwrap_allocate_buffer(union Trapped_Args *args, void *pr_ctxt)
 		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 @@ u32 strmwrap_free_buffer(union Trapped_Args *args, void *pr_ctxt)
 		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);
Signature · 1 line
1.7.0.4