From: Stefan Weil <weil@mail.berlios.de>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] sh4: Fix potential crash in debug code
Date: Sat, 13 Aug 2011 11:25:05 +0200 [thread overview]
Message-ID: <4E4642F1.5010600@mail.berlios.de> (raw)
In-Reply-To: <1311188196-2867-1-git-send-email-weil@mail.berlios.de>
Am 20.07.2011 20:56, schrieb Stefan Weil:
> cppcheck reports this error:
>
> qemu/hw/sh_intc.c:390: error: Possible null pointer dereference:
> s - otherwise it is redundant to check if s is null at line 385
>
> If s were NULL, the printf() statement would crash.
> Setting braces fixes this bug.
>
> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
> ---
> hw/sh_intc.c | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/sh_intc.c b/hw/sh_intc.c
> index 0734da9..f73a4b0 100644
> --- a/hw/sh_intc.c
> +++ b/hw/sh_intc.c
> @@ -382,13 +382,14 @@ void sh_intc_register_sources(struct intc_desc *desc,
>
> sh_intc_register_source(desc, vect->enum_id, groups, nr_groups);
> s = sh_intc_source(desc, vect->enum_id);
> - if (s)
> - s->vect = vect->vect;
> + if (s) {
> + s->vect = vect->vect;
>
> #ifdef DEBUG_INTC_SOURCES
> - printf("sh_intc: registered source %d -> 0x%04x (%d/%d)\n",
> - vect->enum_id, s->vect, s->enable_count, s->enable_max);
> + printf("sh_intc: registered source %d -> 0x%04x (%d/%d)\n",
> + vect->enum_id, s->vect, s->enable_count, s->enable_max);
> #endif
> + }
> }
>
> if (groups) {
>
Ping?
next prev parent reply other threads:[~2011-08-13 9:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-20 18:56 [Qemu-devel] [PATCH] sh4: Fix potential crash in debug code Stefan Weil
2011-07-20 18:56 ` [Qemu-devel] [PATCH] tcg/mips: Fix regression caused by typo (copy + paste bug) Stefan Weil
2011-07-25 10:22 ` [Qemu-devel] [Qemu-trivial] [PATCH] sh4: Fix potential crash in debug code Stefan Hajnoczi
2011-08-13 9:25 ` Stefan Weil [this message]
2011-08-27 19:27 ` [Qemu-devel] " Stefan Weil
2011-08-28 11:13 ` Andreas Färber
2011-08-29 11:39 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
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=4E4642F1.5010600@mail.berlios.de \
--to=weil@mail.berlios.de \
--cc=aurelien@aurel32.net \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.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;
as well as URLs for NNTP newsgroup(s).