diff options
author | Stefan Weil <weil@mail.berlios.de> | 2011-07-20 20:56:35 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2011-09-02 10:49:12 +0100 |
commit | 6f9faa91f5fb3a866f5bf592207c9498a017740d (patch) | |
tree | 2e129bb90ef9b37f1bf237a28820cdf862e95c9e /hw/sh_intc.c | |
parent | 625f9e1f54cd78ee98ac22030da527c9a1cc9d2b (diff) |
sh4: Fix potential crash in debug code
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>
Reviewed-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'hw/sh_intc.c')
-rw-r--r-- | 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 ecb46e5856..e07424f2a1 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) { |