* [PATCH v2] staging: media: davinci_vpfe: add error handling on kmalloc failure
[not found] <CGME20180319053315epcas2p3c61bd9a1bec8d67cde77765842a3205c@epcas2p3.samsung.com>
@ 2018-03-19 5:32 ` Ji-Hun Kim
0 siblings, 0 replies; 2+ messages in thread
From: Ji-Hun Kim @ 2018-03-19 5:32 UTC (permalink / raw)
To: mchehab, dan.carpenter
Cc: gregkh, arvind.yadav.cs, ji_hun.kim, linux-media, devel,
linux-kernel, kernel-janitors
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@samsung.com>
---
Changes since v1:
- Return with -ENOMEM directly, instead of goto error: then return.
drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index 6a3434c..ffcd86d 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -1280,6 +1280,9 @@ 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)
+ return -ENOMEM;
+
to = (void *)params + module_if->param_offset;
size = module_if->param_size;
@@ -1323,6 +1326,9 @@ 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)
+ return -ENOMEM;
+
from = (void *)params + module_if->param_offset;
size = module_if->param_size;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v2] staging: media: davinci_vpfe: add error handling on kmalloc failure
@ 2018-03-19 5:32 ` Ji-Hun Kim
0 siblings, 0 replies; 2+ messages in thread
From: Ji-Hun Kim @ 2018-03-19 5:32 UTC (permalink / raw)
To: mchehab, dan.carpenter
Cc: gregkh, arvind.yadav.cs, ji_hun.kim, linux-media, devel,
linux-kernel, kernel-janitors
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@samsung.com>
---
Changes since v1:
- Return with -ENOMEM directly, instead of goto error: then return.
drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index 6a3434c..ffcd86d 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -1280,6 +1280,9 @@ 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)
+ return -ENOMEM;
+
to = (void *)params + module_if->param_offset;
size = module_if->param_size;
@@ -1323,6 +1326,9 @@ 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)
+ return -ENOMEM;
+
from = (void *)params + module_if->param_offset;
size = module_if->param_size;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-19 5:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20180319053315epcas2p3c61bd9a1bec8d67cde77765842a3205c@epcas2p3.samsung.com>
2018-03-19 5:32 ` [PATCH v2] staging: media: davinci_vpfe: add error handling on kmalloc failure Ji-Hun Kim
2018-03-19 5:32 ` Ji-Hun Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.