* [PATCH] extcon: cros-ec: Fix a potential NULL pointer dereference
@ 2017-08-07 6:30 ` Christophe JAILLET
0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2017-08-07 6:30 UTC (permalink / raw)
To: myungjoo.ham, cw00.choi; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET
Return -ENOMEM in case of memory allocation failure. This avoids a NULL
pointer dereference.
Fixes: c69831666109 ("extcon: cros-ec: Add extcon-cros-ec driver to support display out")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/extcon/extcon-usbc-cros-ec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c
index e759ed477735..598956f1dcae 100644
--- a/drivers/extcon/extcon-usbc-cros-ec.c
+++ b/drivers/extcon/extcon-usbc-cros-ec.c
@@ -68,6 +68,8 @@ static int cros_ec_pd_command(struct cros_ec_extcon_info *info,
int ret;
msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL);
+ if (!msg)
+ return -ENOMEM;
msg->version = version;
msg->command = command;
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] extcon: cros-ec: Fix a potential NULL pointer dereference
@ 2017-08-07 6:30 ` Christophe JAILLET
0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2017-08-07 6:30 UTC (permalink / raw)
To: myungjoo.ham, cw00.choi; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET
Return -ENOMEM in case of memory allocation failure. This avoids a NULL
pointer dereference.
Fixes: c69831666109 ("extcon: cros-ec: Add extcon-cros-ec driver to support display out")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/extcon/extcon-usbc-cros-ec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c
index e759ed477735..598956f1dcae 100644
--- a/drivers/extcon/extcon-usbc-cros-ec.c
+++ b/drivers/extcon/extcon-usbc-cros-ec.c
@@ -68,6 +68,8 @@ static int cros_ec_pd_command(struct cros_ec_extcon_info *info,
int ret;
msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL);
+ if (!msg)
+ return -ENOMEM;
msg->version = version;
msg->command = command;
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] extcon: cros-ec: Fix a potential NULL pointer dereference
2017-08-07 6:30 ` Christophe JAILLET
@ 2017-08-07 6:41 ` Chanwoo Choi
-1 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2017-08-07 6:41 UTC (permalink / raw)
To: Christophe JAILLET, myungjoo.ham; +Cc: linux-kernel, kernel-janitors
Hi,
On 2017년 08월 07일 15:30, Christophe JAILLET wrote:
> Return -ENOMEM in case of memory allocation failure. This avoids a NULL
> pointer dereference.
>
> Fixes: c69831666109 ("extcon: cros-ec: Add extcon-cros-ec driver to support display out")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/extcon/extcon-usbc-cros-ec.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c
> index e759ed477735..598956f1dcae 100644
> --- a/drivers/extcon/extcon-usbc-cros-ec.c
> +++ b/drivers/extcon/extcon-usbc-cros-ec.c
> @@ -68,6 +68,8 @@ static int cros_ec_pd_command(struct cros_ec_extcon_info *info,
> int ret;
>
> msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL);
> + if (!msg)
> + return -ENOMEM;
>
> msg->version = version;
> msg->command = command;
>
Applied it. Thanks.
--
Best Regards,
Chanwoo Choi
Samsung Electronics
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] extcon: cros-ec: Fix a potential NULL pointer dereference
@ 2017-08-07 6:41 ` Chanwoo Choi
0 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2017-08-07 6:41 UTC (permalink / raw)
To: Christophe JAILLET, myungjoo.ham; +Cc: linux-kernel, kernel-janitors
Hi,
On 2017년 08월 07일 15:30, Christophe JAILLET wrote:
> Return -ENOMEM in case of memory allocation failure. This avoids a NULL
> pointer dereference.
>
> Fixes: c69831666109 ("extcon: cros-ec: Add extcon-cros-ec driver to support display out")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/extcon/extcon-usbc-cros-ec.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c
> index e759ed477735..598956f1dcae 100644
> --- a/drivers/extcon/extcon-usbc-cros-ec.c
> +++ b/drivers/extcon/extcon-usbc-cros-ec.c
> @@ -68,6 +68,8 @@ static int cros_ec_pd_command(struct cros_ec_extcon_info *info,
> int ret;
>
> msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL);
> + if (!msg)
> + return -ENOMEM;
>
> msg->version = version;
> msg->command = command;
>
Applied it. Thanks.
--
Best Regards,
Chanwoo Choi
Samsung Electronics
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-07 6:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20170807063041epcas1p24acf2ca9a0dc16bbf1a800ad0dbb3e01@epcas1p2.samsung.com>
2017-08-07 6:30 ` [PATCH] extcon: cros-ec: Fix a potential NULL pointer dereference Christophe JAILLET
2017-08-07 6:30 ` Christophe JAILLET
2017-08-07 6:41 ` Chanwoo Choi
2017-08-07 6:41 ` Chanwoo Choi
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.