qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
	"Markus Armbruster" <armbru@redhat.com>
Cc: QEMU <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PULL v2 16/20] qapi: Consistent generated code: prefer common indentation
Date: Wed, 14 Oct 2015 10:24:15 -0600	[thread overview]
Message-ID: <561E81AF.7000302@redhat.com> (raw)
In-Reply-To: <CAJ+F1CLb1GbHOpbtginACui+eFwEqvwBpOwqTc1p+zUx9po6og@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1696 bytes --]

On 10/14/2015 10:01 AM, Marc-André Lureau wrote:
> Hi,
> 
> This patch introduces a regression:
> 
> $ x86_64-softmmu/qemu-system-x86_64 -netdev ?
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000555555a0bc0f in visit_type_NetClientOptions (v=0x5555564e19e0,
> obj=0x555556510438, name=0x555555af7041 "opts", errp=0x7fffffffd450)
> at qapi-visit.c:6906
> 6906        visit_end_union(v, !!(*obj)->data, &err);
> (gdb) print *obj
> $1 = (NetClientOptions *) 0x0

visit_end_union() is pointless (it is a no-op). I plan on properly
deleting visit_begin_union/visit_end_union later in my series.

But in the meantime, I see the source of the problem:

>> @@ -264,16 +264,18 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error
>>      if (err) {
>>          goto out;
>>      }
>> -    if (*obj) {
>> +    if (!*obj) {
>> +        goto out_obj;
>> +    }
>>  ''',
>>                   c_name=c_name(name), name=name)

>>      ret += mcgen('''
>> -        default:
>> -            abort();
>> -        }
>> -out_obj:
>> -        error_propagate(errp, err);
>> -        err = NULL;
>> -        visit_end_union(v, !!(*obj)->data, &err);
>> -        error_propagate(errp, err);
>> -        err = NULL;
>> +    default:
>> +        abort();
>>      }
>> +out_obj:
>> +    error_propagate(errp, err);
>> +    err = NULL;
>> +    visit_end_union(v, !!(*obj)->data, &err);

The call to visit_end_union() used to be conditional on whether *obj was
non-NULL.  So I'll post the quick and obvious fix.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-10-14 16:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 18:19 [Qemu-devel] [PULL v2 00/20] QAPI patches Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 01/20] docs: Move files from docs/qmp/ to docs/ Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 02/20] MAINTAINERS: Specify QObject include and test files Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 03/20] MAINTAINERS: Specify QAPI " Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 04/20] qapi: Sort qapi-schema tests Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 05/20] qapi: Improve 'include' error message Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 06/20] qapi: Invoke exception superclass initializer Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 07/20] qapi: Clean up qapi.py per pep8 Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 08/20] qapi: Test for various name collisions Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 09/20] qapi: Avoid assertion failure on union 'type' collision Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 10/20] qapi: Add tests for empty unions Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 11/20] qapi: Test use of 'number' within alternates Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 12/20] qapi: Reuse code for flat union base validation Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 13/20] qapi: Consistent generated code: prefer error 'err' Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 14/20] qapi: Consistent generated code: prefer visitor 'v' Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 15/20] qapi: Consistent generated code: prefer common labels Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 16/20] qapi: Consistent generated code: prefer common indentation Markus Armbruster
2015-10-14 16:01   ` Marc-André Lureau
2015-10-14 16:24     ` Eric Blake [this message]
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 17/20] qapi: Consistent generated code: minimize push_indent() usage Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 18/20] qapi: Share gen_err_check() Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 19/20] qapi: Share gen_visit_fields() Markus Armbruster
2015-10-12 18:19 ` [Qemu-devel] [PULL v2 20/20] qapi: Simplify gen_visit_fields() error handling Markus Armbruster
2015-10-13 10:55 ` [Qemu-devel] [PULL v2 00/20] QAPI patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561E81AF.7000302@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).