public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	myungjoo.ham@samsung.com
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] extcon: cros-ec: Fix a potential NULL pointer dereference
Date: Mon, 07 Aug 2017 15:41:03 +0900	[thread overview]
Message-ID: <59880B7F.2020300@samsung.com> (raw)
In-Reply-To: <20170807063033.8063-1-christophe.jaillet@wanadoo.fr>

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

      reply	other threads:[~2017-08-07  6:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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:41   ` Chanwoo Choi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59880B7F.2020300@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox