[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] nbd: Initialize reply on failure
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] nbd: Initialize reply on failure |
Date: |
Fri, 19 Jul 2019 11:03:29 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
On 7/19/19 10:53 AM, Philippe Mathieu-Daudé wrote:
>> if (ret < 0) {
>> + memset(reply, 0, sizeof *reply);
>
> I never had problem with sizeof without parenthesis, but here I find it
> not easy to review.
Holdover from my work on GNU coding style projects: the rationale is
that you can tell 'sizeof(type)' apart from 'sizeof expr' if you always
omit the () in the latter case, which further makes it possible to tell
at a glance when you are using the expr form (preferred, because the
type of the expression can change and the sizeof is still correct) or a
type name (harder to audit, since changing a variable's type means you
also have to change any associated sizeof in later code using that
variable). But I will readily admit qemu is not GNU style:
$ git grep 'sizeof ' | wc
394 2500 29756
$ git grep 'sizeof(' | wc
8899 46172 671537
so I've fixed it to use ().
>
> Anyhow, this definitively looks like 4.1 material.
>
> Preferently with sizeof(), but I don't mind, so:
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Thanks. Queued on my NBD tree for -rc2.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature