[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] trace: add sanity check
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH] trace: add sanity check |
Date: |
Wed, 10 May 2017 12:29:27 -0400 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
On Tue, May 09, 2017 at 03:37:12PM -0700, Anthony Xu wrote:
> If trace backend is set to TRACE_NOP, trace_get_vcpu_event_count
> returns 0, cause bitmap_new call abort.
>
> Signed-off-by: Anthony Xu <address@hidden>
> ---
> qom/cpu.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Please post steps for reproducing the abort. I cannot reproduce this
with qemu-system-x86_64.
> diff --git a/qom/cpu.c b/qom/cpu.c
> index f02e9c0..f9111a0 100644
> --- a/qom/cpu.c
> +++ b/qom/cpu.c
> @@ -382,6 +382,7 @@ static void cpu_common_unrealizefn(DeviceState *dev,
> Error **errp)
>
> static void cpu_common_initfn(Object *obj)
> {
> + uint32_t count;
> CPUState *cpu = CPU(obj);
> CPUClass *cc = CPU_GET_CLASS(obj);
>
> @@ -396,7 +397,10 @@ static void cpu_common_initfn(Object *obj)
> QTAILQ_INIT(&cpu->breakpoints);
> QTAILQ_INIT(&cpu->watchpoints);
>
> - cpu->trace_dstate = bitmap_new(trace_get_vcpu_event_count());
> + count = trace_get_vcpu_event_count();
> + if (count) {
> + cpu->trace_dstate = bitmap_new(count);
> + }
>
> cpu_exec_initfn(cpu);
> }
> --
> 1.8.3.1
>
>
signature.asc
Description: PGP signature