[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <54D34F93.8050809@samsung.com>
Date: Thu, 05 Feb 2015 12:10:11 +0100
From: Andrzej Hajda <a.hajda@...sung.com>
To: Kiran Padwal <kiran.padwal@...rtplayin.com>,
Mauro Carvalho Chehab <mchehab@....samsung.com>
Cc: Kyungmin Park <kyungmin.park@...sung.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
kiran.padwal21@...il.com
Subject: Re: [PATCH] [media] s5k5baf: Add missing error check for devm_kzalloc
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@...rtplayin.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@...sung.com>
Regards
Andrzej
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists