staging: tidspbridge: check kmalloc() result
authorKulikov Vasiliy <segooon@gmail.com>
Fri, 16 Jul 2010 16:14:11 +0000 (20:14 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 22 Jul 2010 17:54:03 +0000 (10:54 -0700)
If kmalloc() fails then exit with -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/tidspbridge/pmgr/dspapi.c

index 1170798cc4cae30fecd91d18a5c5149f634d40e7..57abe3322c6f97b66b1bef7db65a4ab25c701bfa 100644 (file)
@@ -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);