diff options
author | Mahammad Ismayilzada <mahammad.ismayilzada@freescale.com> | 2015-06-23 22:04:07 (GMT) |
---|---|---|
committer | Haiying Wang <Haiying.wang@freescale.com> | 2015-11-02 19:58:17 (GMT) |
commit | 3ac31aa3d0c611fbbcc07dcac7da7574f9b692bc (patch) | |
tree | bea40456c18ff753442875d260777e8a66d1b96a /drivers/staging/fsl_dce/tests/performance_simple/dce_perf_simple.c | |
parent | e11b65b593068fcfb9f838cbffe7df69ea471c12 (diff) | |
download | linux-fsl-qoriq-3ac31aa3d0c611fbbcc07dcac7da7574f9b692bc.tar.xz |
fsl-dce: Handle memory allocation failures
Check for memory allocation failures to protect from
null pointer dereferencing
Signed-off-by: Mahammad Ismayilzada <mahammad.ismayilzada@freescale.com>
Diffstat (limited to 'drivers/staging/fsl_dce/tests/performance_simple/dce_perf_simple.c')
-rw-r--r-- | drivers/staging/fsl_dce/tests/performance_simple/dce_perf_simple.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/staging/fsl_dce/tests/performance_simple/dce_perf_simple.c b/drivers/staging/fsl_dce/tests/performance_simple/dce_perf_simple.c index d91c42c..388f420 100644 --- a/drivers/staging/fsl_dce/tests/performance_simple/dce_perf_simple.c +++ b/drivers/staging/fsl_dce/tests/performance_simple/dce_perf_simple.c @@ -816,8 +816,10 @@ static int do_operation(void) pr_err("fsl_dce_chunk_deflate_params failed %d\n", ret); def_process_req = kzalloc(sizeof(*def_process_req), GFP_KERNEL); - if (!def_process_req) + if (!def_process_req) { pr_err("Line %d\n", __LINE__); + return -ENOMEM; + } init_completion(&def_process_req->cb_done); @@ -951,8 +953,10 @@ done: if (fsl_dce_get_status(def_process_req->output_fd.status) != STREAM_END) goto skip_output_copy; test_data->out_data = vmalloc(def_process_req->dce_cf[0].length); - if (!test_data->out_data) + if (!test_data->out_data) { pr_err("Unable to allocate output data\n"); + return -ENOMEM; + } test_data->out_data_len = def_process_req->dce_cf[0].length; if (!bman_output) { |