[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 23/35] x86: ioapic: dump version for "info ioapic
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PULL 23/35] x86: ioapic: dump version for "info ioapic" |
Date: |
Mon, 30 Jan 2017 14:07:28 +0000 |
On 20 January 2017 at 13:31, Paolo Bonzini <address@hidden> wrote:
> From: Peter Xu <address@hidden>
>
> Signed-off-by: Peter Xu <address@hidden>
> Message-Id: <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> hw/intc/ioapic_common.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c
> index 1b7ec5e..97c4f9c 100644
> --- a/hw/intc/ioapic_common.c
> +++ b/hw/intc/ioapic_common.c
> @@ -58,7 +58,8 @@ void ioapic_print_redtbl(Monitor *mon, IOAPICCommonState *s)
> uint32_t remote_irr = 0;
> int i;
>
> - monitor_printf(mon, "ioapic id=0x%02x sel=0x%02x", s->id, s->ioregsel);
> + monitor_printf(mon, "ioapic ver=0x%x id=0x%02x sel=0x%02x",
> + s->version, s->id, s->ioregsel);
> if (s->ioregsel) {
> monitor_printf(mon, " (redir[%u])\n",
> (s->ioregsel - IOAPIC_REG_REDTBL_BASE) >> 1);
Coverity points out (CID 1369422) that this is a use of a possibly
uninitialized field. In kvm_ioapic_dump_state() we do:
IOAPICCommonState s;
kvm_ioapic_get(&s);
ioapic_print_redtbl(mon, &s);
and kvm_ioapic_get() doesn't initialize s->version, so when we
come to print it in ioapic_print_redtbl() it's uninitialized.
The easy fix is to initialize version to something. The
underlying problem here I think is that we're manufacturing
a fake IOAPICCommonState rather than finding the one that
corresponds to the actual IOAPIC device in the system...
thanks
-- PMM
- [Qemu-devel] [PULL 15/35] stubs: remove stubs/kvm.c, (continued)
- [Qemu-devel] [PULL 15/35] stubs: remove stubs/kvm.c, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 18/35] scsi-block: fix direction of BYTCHK test for VERIFY commands, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 17/35] pc: fix crash in rtc_set_memory() if initial cpu is marked as hotplugged, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 19/35] serial: fix memory leak in serial exit, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 20/35] qemu-thread: fix qemu_thread_set_name() race in qemu_thread_create(), Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 21/35] hxtool: emit Texinfo headings as @subsection, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 25/35] exec: Add missing rcu_read_unlock, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 22/35] x86: ioapic: add traces for ioapic, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 24/35] x86: ioapic: fix fail migration when irqchip=split, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 23/35] x86: ioapic: dump version for "info ioapic", Paolo Bonzini, 2017/01/20
- Re: [Qemu-devel] [PULL 23/35] x86: ioapic: dump version for "info ioapic",
Peter Maydell <=
- [Qemu-devel] [PULL 26/35] char: fix ctrl-a b not working, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 27/35] ramblock-notifier: new, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 28/35] KVM: PPC: eliminate unnecessary duplicate constants, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 29/35] kvm: move cpu synchronization code, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 32/35] hax: add Darwin support, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 31/35] Plumb the HAXM-based hardware acceleration support, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 33/35] Revert "win32: don't run subprocess tests on Mingw32 platform", Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 35/35] pc.h: move x-mach-use-reliable-get-clock compat entry to PC_COMPAT_2_8, Paolo Bonzini, 2017/01/20
- [Qemu-devel] [PULL 34/35] bitmap: assert that start and nr are non negative, Paolo Bonzini, 2017/01/20