浏览代码

msm: adsprpc: adding proper null check.

after allocation of a buffer, verify if null is returned.
if null check is success then bailout.

Change-Id: Idbc94c6cf109d34340b55b25f8df74afd5975d36
Signed-off-by: Vamsi Krishna Gattupalli <[email protected]>
Acked-by: ANANDU E <[email protected]>
Vamsi Krishna Gattupalli 2 年之前
父节点
当前提交
e92ce41f5a
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      dsp/adsprpc.c

+ 4 - 1
dsp/adsprpc.c

@@ -4038,6 +4038,8 @@ static int fastrpc_init_create_static_process(struct fastrpc_file *fl,
 
 			VERIFY(err, NULL != (dst_perms = kcalloc(rhvm->vmcount,
 						sizeof(struct qcom_scm_vmperm), GFP_KERNEL)));
+			if (err)
+				goto bail;
 			for (i = 0; i < rhvm->vmcount; i++) {
 				dst_perms[i].vmid = rhvm->vmid[i];
 				dst_perms[i].perm = rhvm->vmperm[i];
@@ -4676,7 +4678,8 @@ static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags,
 
 		VERIFY(err, NULL != (dst_perms = kcalloc(rhvm->vmcount,
 					sizeof(struct qcom_scm_vmperm), GFP_KERNEL)));
-
+		if (err)
+			goto bail;
 		for (i = 0; i < rhvm->vmcount; i++) {
 			dst_perms[i].vmid = rhvm->vmid[i];
 			dst_perms[i].perm = rhvm->vmperm[i];