All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Hajda <a.hajda@samsung.com>
To: Kiran Padwal <kiran.padwal@smartplayin.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	kiran.padwal21@gmail.com
Subject: Re: [PATCH] [media] s5k5baf: Add missing error check for devm_kzalloc
Date: Thu, 05 Feb 2015 12:10:11 +0100	[thread overview]
Message-ID: <54D34F93.8050809@samsung.com> (raw)
In-Reply-To: <1423130950-3922-1-git-send-email-kiran.padwal@smartplayin.com>

Hi Kiran,

Thanks for spotting it.

On 02/05/2015 11:09 AM, Kiran Padwal wrote:
> This patch add a missing a check on the return value of devm_kzalloc,
> which would cause a NULL pointer dereference in a OOM situation.
>
> Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
> ---
>  drivers/media/i2c/s5k5baf.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
> index 60a74d8..156b975 100644
> --- a/drivers/media/i2c/s5k5baf.c
> +++ b/drivers/media/i2c/s5k5baf.c
> @@ -374,6 +374,8 @@ static int s5k5baf_fw_parse(struct device *dev, struct s5k5baf_fw **fw,
>  	count -= S5K5BAG_FW_TAG_LEN;
>  
>  	d = devm_kzalloc(dev, count * sizeof(u16), GFP_KERNEL);
> +	if (!d)
> +		return -ENOMEM;
>  
>  	for (i = 0; i < count; ++i)
>  		d[i] = le16_to_cpu(data[i]);
Acked-by: Andrzej Hajda <a.hajda@samsung.com>

Regards
Andrzej

      reply	other threads:[~2015-02-05 11:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-05 10:09 [PATCH] [media] s5k5baf: Add missing error check for devm_kzalloc Kiran Padwal
2015-02-05 11:10 ` Andrzej Hajda [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=54D34F93.8050809@samsung.com \
    --to=a.hajda@samsung.com \
    --cc=kiran.padwal21@gmail.com \
    --cc=kiran.padwal@smartplayin.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.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 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.