[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <59880B7F.2020300@samsung.com>
Date: Mon, 07 Aug 2017 15:41:03 +0900
From: Chanwoo Choi <cw00.choi@...sung.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
myungjoo.ham@...sung.com
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] extcon: cros-ec: Fix a potential NULL pointer
dereference
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@...adoo.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
Powered by blists - more mailing lists