From: Jan Kiszka <jan.kiszka@siemens.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH for 1.2] console: Fix warning from clang (and potential crash)
Date: Fri, 17 Aug 2012 16:10:55 +0200 [thread overview]
Message-ID: <502E50EF.7060707@siemens.com> (raw)
In-Reply-To: <1345211444-5002-1-git-send-email-sw@weilnetz.de>
On 2012-08-17 15:50, Stefan Weil wrote:
> ccc-analyzer reports this warning:
>
> console.c:1090:29: warning: Dereference of null pointer
> if (active_console->cursor_timer) {
> ^
>
> Function console_select allows active_console to be NULL,
> but would crash when accessing cursor_timer. Fix this.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>
> Please note that I don't have a test case which triggers the crash.
>
> Regards,
> Stefan Weil
>
> console.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/console.c b/console.c
> index 4525cc7..f5e8814 100644
> --- a/console.c
> +++ b/console.c
> @@ -1087,7 +1087,7 @@ void console_select(unsigned int index)
> if (s) {
> DisplayState *ds = s->ds;
>
> - if (active_console->cursor_timer) {
> + if (active_console && active_console->cursor_timer) {
> qemu_del_timer(active_console->cursor_timer);
> }
> active_console = s;
>
The only path that could trigger this is console_select() in the absence
of any console. Not sure if that is possible, but the above is surely
consistent with existing code.
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2012-08-17 14:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-17 13:50 [Qemu-devel] [PATCH for 1.2] console: Fix warning from clang (and potential crash) Stefan Weil
2012-08-17 14:10 ` Jan Kiszka [this message]
2012-08-30 20:47 ` Stefan Weil
2012-08-30 21:38 ` Anthony Liguori
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=502E50EF.7060707@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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.