[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-devel] [PATCH] qom: suppress conscan warning of
From: |
Gonglei (Arei) |
Subject: |
Re: [Qemu-trivial] [Qemu-devel] [PATCH] qom: suppress conscan warning of returning null point |
Date: |
Sat, 20 Sep 2014 02:41:18 +0000 |
> Subject: [Qemu-devel] [PATCH] qom: suppress conscan warning of returning null
> point
>
> Conscan complains about g_malloc0() and malloc() return null.
>
> Error: NULL_RETURNS (CWE-476):
> qemu-kvm/qom/object.c:239: returned_null: Function "g_malloc0(gsize)"
> returns null.
> qemu-kvm/qom/object.c:239: var_assigned: Assigning: "ti->class" = null
> return value from "g_malloc0(gsize)".
> qemu-kvm/qom/object.c:249: dereference: Dereferencing a null pointer
> "ti->class".
>
> But if the passed size parameter is >= 1, then we can always get an
> effective pointer, the warning disappears.
>
> Signed-off-by: Amos Kong <address@hidden>
> ---
> qom/object.c | 2 ++
> 1 file changed, 2 insertions(+)
>
Reviewed-by: Gonglei <address@hidden>
Best regards,
-Gonglei