From: Antti Palosaari <crope@iki.fi>
To: Colin King <colin.king@canonical.com>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [media] hackrf: don't emit dev debug on a kfree'd or null dev
Date: Wed, 11 Nov 2015 17:41:09 +0200 [thread overview]
Message-ID: <56436195.7070204@iki.fi> (raw)
In-Reply-To: <1447254353-12452-1-git-send-email-colin.king@canonical.com>
On 11/11/2015 05:05 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Static analysis with smatch detected a couple of issues:
>
> drivers/media/usb/hackrf/hackrf.c:1533 hackrf_probe()
> error: we previously assumed 'dev' could be null (see line 1366)
> drivers/media/usb/hackrf/hackrf.c:1533 hackrf_probe()
> error: dereferencing freed memory 'dev'
>
> A dev_dbg message is being output on a kfree'd dev. Worse, if dev
> is not allocated earlier, on, a null pointer deference on dev->dev
> can occur onthe deb_dbg call. Clean this up by only printing a debug
> message if dev is not null and has not been kfree'd.
It is already fixed:
https://patchwork.linuxtv.org/patch/31712/
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/media/usb/hackrf/hackrf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c
> index e05bfec..faf3670 100644
> --- a/drivers/media/usb/hackrf/hackrf.c
> +++ b/drivers/media/usb/hackrf/hackrf.c
> @@ -1528,9 +1528,9 @@ err_v4l2_ctrl_handler_free_tx:
> err_v4l2_ctrl_handler_free_rx:
> v4l2_ctrl_handler_free(&dev->rx_ctrl_handler);
> err_kfree:
> + dev_dbg(dev->dev, "failed=%d\n", ret);
> kfree(dev);
> err:
> - dev_dbg(dev->dev, "failed=%d\n", ret);
> return ret;
> }
>
>
regards
Antti
--
http://palosaari.fi/
prev parent reply other threads:[~2015-11-11 15:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-11 15:05 Colin King
2015-11-11 15:41 ` Antti Palosaari [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=56436195.7070204@iki.fi \
--to=crope@iki.fi \
--cc=colin.king@canonical.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome