qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 06/46] error: Avoid error_propagate() when error is not used


From: Eric Blake
Subject: Re: [PATCH 06/46] error: Avoid error_propagate() when error is not used here
Date: Wed, 24 Jun 2020 13:17:08 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 6/24/20 11:43 AM, Markus Armbruster wrote:
When all we do with an Error we receive into a local variable is
propagating to somewhere else, we can just as well receive it there
right away.  Coccinelle script:

This seems to be a recurring cleanup (witness commit 06592d7e, c0e90679, 6b62d961). In fact, shouldn't you just update that script with your enhancements here, and then run it directly, instead of embedding your tweaks in the commit message?


     @@
     identifier fun, err, errp;
     expression list args;
     @@
     -    fun(args, &err);
     +    fun(args, errp);
          ... when != err
              when strict
     -    error_propagate(errp, err);

What does the 'when strict' accomplish? The existing coccinelle script uses 'when != errp', which may be enough to address...


The first two rules are prone to fail with "error_propagate(...)
... reachable by inconsistent control-flow paths".  Script without
them re-run where that happens.

...the control-flow failures you hit?


Manually double-check @err is not used afterwards.  Dereferencing it
would be use after free, but checking whether it's null would be
legitimate.  One such change to qbus_realize() backed out.

Suboptimal line breaks tweaked manually.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---

  22 files changed, 31 insertions(+), 73 deletions(-)

At any rate, it's small enough to ensure all the changes remaining are still valid.

Reviewed-by: Eric Blake <eblake@redhat.com>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]