[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qapi: Fix potential NULL pointer segfault
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] qapi: Fix potential NULL pointer segfault |
Date: |
Mon, 03 Sep 2012 08:57:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 |
Il 01/09/2012 09:30, Stefan Weil ha scritto:
> Report from smatch:
>
> qapi-visit.c:1640 visit_type_BlockdevAction(8) error:
> we previously assumed 'obj' could be null (see line 1639)
> qapi-visit.c:2432 visit_type_NetClientOptions(8) error:
> we previously assumed 'obj' could be null (see line 2431)
>
> Signed-off-by: Stefan Weil <address@hidden>
> ---
> scripts/qapi-visit.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
> index 2afc5c0..1a669f3 100644
> --- a/scripts/qapi-visit.py
> +++ b/scripts/qapi-visit.py
> @@ -157,7 +157,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj,
> const char *name, Error **
> if (!error_is_set(errp)) {
> visit_start_struct(m, (void **)obj, "%(name)s", name,
> sizeof(%(name)s), &err);
> if (!err) {
> - if (!obj || *obj) {
> + if (obj && *obj) {
> visit_type_%(name)sKind(m, &(*obj)->kind, "type", &err);
> if (!err) {
> switch ((*obj)->kind) {
>
Reviewed-by: Paolo Bonzini <address@hidden>
Paolo