On Mon, Mar 27, 2017 at 03:49:13PM +0530, Tejaswini wrote: Thanks for the patch!
Please CC the maintainers of target/i386/helper.c: $ scripts/get_maintainer.pl -f target/i386/helper.c Paolo Bonzini <pbonz...@redhat.com> (maintainer:X86) Richard Henderson <r...@twiddle.net> (maintainer:X86) Eduardo Habkost <ehabk...@redhat.com> (maintainer:X86) Please shorten the subject line: [[RFC][Bugfix:isapc lapic state]] Bugfix: isapc:apic_state ?Start QEMU with "qemu-system-x86_64 -nographic -M isapc -serial none -monitor stdio" ?and enter "info lapic" at the monitor prompt ⇒ Segmentation fault I suggest: [PATCH] target-i386: fix "info lapic" segfault on isapc The commit message (subject line) should be a short summary of the patch. Typically this is below 80 or even 72 characters. Details go in the commit description (email body before '---'), which can be arbitrarily long. Please move the command-line for reproducing the segmentation fault into the commit description. Please don't add extra tags to the Subject line unless you're sure they are commonly used in QEMU (e.g. "[Bugfix:isapc lapic state]] Bugfix: isapc:apic_state"). > From: Tejaswini Poluri <tejaswinipolu...@gmail.com> > > The error occurs for only isapc machine type as it doesn't have apic > state > The cpu->apic_state of isapc is NULL. Hence added null pointer check in > x86_cpu_dump_local_apic_state() Please remove the indentation. > > Signed-off-by: Tejaswini Poluri <tejaswinipolu...@gmail.com> > --- > target/i386/helper.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/target/i386/helper.c b/target/i386/helper.c > index e2af340..1a8e3dd 100644 > --- a/target/i386/helper.c > +++ b/target/i386/helper.c > @@ -327,7 +327,10 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f, > X86CPU *cpu = X86_CPU(cs); > APICCommonState *s = APIC_COMMON(cpu->apic_state); > uint32_t *lvt = s->lvt; > - > + if (!s) { > + cpu_fprintf(f, "apic state not available\n"); > + return; > + } Did you test this code? The dereference one line above will still cause a segfault: uint32_t *lvt = s->lvt; <--- s is NULL!
signature.asc
Description: PGP signature