[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150512210211.GB10039@kroah.com>
Date: Tue, 12 May 2015 14:02:11 -0700
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Colin King <colin.king@...onical.com>
Cc: Gigi Joseph <gigi.joseph@...il.com>, Eyal Reizer <eyalr@...com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ti-st: handle null allocation return correctly.
On Tue, May 12, 2015 at 07:23:03PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> static analysis with smatch picked up the following error:
>
> get_platform_data() error: potential null dereference 'dt_pdata'.
> (kzalloc returns null)
>
> ironically, the code already checks for a null kzalloc return and
> emits an error message. Fix by adding an error return of NULL rather
> than continuing and tripping the null dereference.
>
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> drivers/misc/ti-st/st_kim.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
> index 18e7a03..5a5265a 100644
> --- a/drivers/misc/ti-st/st_kim.c
> +++ b/drivers/misc/ti-st/st_kim.c
> @@ -753,8 +753,10 @@ static struct ti_st_plat_data *get_platform_data(struct device *dev)
>
> dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL);
>
> - if (!dt_pdata)
> + if (!dt_pdata) {
> pr_err("Can't allocate device_tree platform data\n");
Care to remove this as well? It's not needed.
thanks,
greg k-h
--
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