From 6f9faa91f5fb3a866f5bf592207c9498a017740d Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 20 Jul 2011 20:56:35 +0200 Subject: [PATCH 1/3] sh4: Fix potential crash in debug code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Andreas Färber Signed-off-by: Stefan Hajnoczi --- hw/sh_intc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/sh_intc.c b/hw/sh_intc.c index ecb46e585..e07424f2a 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) { From c6bfc164e8f929e1e6a79f7b5a3cf096b22ef5f3 Mon Sep 17 00:00:00 2001 From: Boris Figovsky Date: Tue, 30 Aug 2011 10:00:55 +0300 Subject: [PATCH 2/3] x86: fix daa opcode for al register values higher than 0xf9 The second if statement should consider the original al register value, and not the new one. Signed-off-by: Boris Figovsky Reviewed-by: Peter Maydell Signed-off-by: Stefan Hajnoczi --- target-i386/op_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c index 1bbc3b56d..1fc248fa1 100644 --- a/target-i386/op_helper.c +++ b/target-i386/op_helper.c @@ -1970,20 +1970,20 @@ void helper_aas(void) void helper_daa(void) { - int al, af, cf; + int old_al, al, af, cf; int eflags; eflags = helper_cc_compute_all(CC_OP); cf = eflags & CC_C; af = eflags & CC_A; - al = EAX & 0xff; + old_al = al = EAX & 0xff; eflags = 0; if (((al & 0x0f) > 9 ) || af) { al = (al + 6) & 0xff; eflags |= CC_A; } - if ((al > 0x9f) || cf) { + if ((old_al > 0x99) || cf) { al = (al + 0x60) & 0xff; eflags |= CC_C; } From 9f4facbce9dc4037b23baa77950381fc2f92e2d3 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 2 Sep 2011 10:53:26 +0100 Subject: [PATCH 3/3] libcacard: use INSTALL_DATA for data Signed-off-by: Brad Smith Signed-off-by: Stefan Hajnoczi --- libcacard/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcacard/Makefile b/libcacard/Makefile index bf052bcc1..81d9eb520 100644 --- a/libcacard/Makefile +++ b/libcacard/Makefile @@ -56,7 +56,7 @@ install-libcacard: libcacard.pc libcacard.la vscclient $(INSTALL_DIR) "$(DESTDIR)$(libcacard_includedir)" $(INSTALL_DIR) "$(DESTDIR)$(bindir)" $(LIBTOOL) --mode=install $(INSTALL_PROG) vscclient "$(DESTDIR)$(bindir)" - $(LIBTOOL) --mode=install $(INSTALL_PROG) libcacard.la "$(DESTDIR)$(libdir)" + $(LIBTOOL) --mode=install $(INSTALL_DATA) libcacard.la "$(DESTDIR)$(libdir)" $(LIBTOOL) --mode=install $(INSTALL_DATA) libcacard.pc "$(DESTDIR)$(libdir)/pkgconfig" for inc in *.h; do \ $(LIBTOOL) --mode=install $(INSTALL_DATA) $(libcacard_srcpath)/$$inc "$(DESTDIR)$(libcacard_includedir)"; \