Skip to content

Commit

Permalink
staging: tidspbridge: check kmalloc() result
Browse files Browse the repository at this point in the history
If kmalloc() fails then exit with -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Kulikov Vasiliy authored and Greg Kroah-Hartman committed Jul 22, 2010
1 parent 4018e39 commit dd85c99
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/staging/tidspbridge/pmgr/dspapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit dd85c99

Please sign in to comment.