[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <1521176303-17546-1-git-send-email-ji_hun.kim@samsung.com>
Date: Fri, 16 Mar 2018 13:58:23 +0900
From: Ji-Hun Kim <ji_hun.kim@...sung.com>
To: mchehab@...nel.org
Cc: gregkh@...uxfoundation.org, arvind.yadav.cs@...il.com,
ji_hun.kim@...sung.com, linux-media@...r.kernel.org,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH] staging: media: davinci_vpfe: add error handling on kmalloc
failure
There is no failure checking on the param value which will be allocated
memory by kmalloc. Add a null pointer checking statement. Then goto error:
and return -ENOMEM error code when kmalloc is failed.
Signed-off-by: Ji-Hun Kim <ji_hun.kim@...sung.com>
---
drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index 6a3434c..55a922c 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -1280,6 +1280,10 @@ static int ipipe_s_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg)
params = kmalloc(sizeof(struct ipipe_module_params),
GFP_KERNEL);
+ if (!params) {
+ rval = -ENOMEM;
+ goto error;
+ }
to = (void *)params + module_if->param_offset;
size = module_if->param_size;
@@ -1323,6 +1327,10 @@ static int ipipe_g_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg)
params = kmalloc(sizeof(struct ipipe_module_params),
GFP_KERNEL);
+ if (!params) {
+ rval = -ENOMEM;
+ goto error;
+ }
from = (void *)params + module_if->param_offset;
size = module_if->param_size;
--
1.9.1
Powered by blists - more mailing lists