From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Colin King <colin.king@canonical.com>
Cc: Gigi Joseph <gigi.joseph@gmail.com>, Eyal Reizer <eyalr@ti.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ti-st: handle null allocation return correctly.
Date: Tue, 12 May 2015 14:02:11 -0700 [thread overview]
Message-ID: <20150512210211.GB10039@kroah.com> (raw)
In-Reply-To: <1431454983-7800-1-git-send-email-colin.king@canonical.com>
On Tue, May 12, 2015 at 07:23:03PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.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@canonical.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
prev parent reply other threads:[~2015-05-12 21:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 18:23 Colin King
2015-05-12 21:02 ` Greg Kroah-Hartman [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=20150512210211.GB10039@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=colin.king@canonical.com \
--cc=eyalr@ti.com \
--cc=gigi.joseph@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®