All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>,
	Thomas Huth <thuth@redhat.com>,
	"open list:Network Block Dev..." <qemu-block@nongnu.org>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] nbd: Initialize reply on failure
Date: Fri, 19 Jul 2019 11:03:29 -0500	[thread overview]
Message-ID: <2776b453-6c36-2196-b97e-261c2e04fe58@redhat.com> (raw)
In-Reply-To: <fd58019b-7317-4d0c-8632-75e30979eedb@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 1278 bytes --]

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é <philmd@redhat.com>

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


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

  reply	other threads:[~2019-07-19 16:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 15:03 [Qemu-devel] [PATCH] nbd: Initialize reply on failure Eric Blake
2019-07-19 15:17 ` Andrey Shinkevich
2019-07-19 15:53 ` Philippe Mathieu-Daudé
2019-07-19 16:03   ` Eric Blake [this message]
2019-07-19 17:06 ` Eric Blake
2019-07-19 17:15 ` Eric Blake
2019-07-19 17:17   ` Philippe Mathieu-Daudé

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=2776b453-6c36-2196-b97e-261c2e04fe58@redhat.com \
    --to=eblake@redhat.com \
    --cc=andrey.shinkevich@virtuozzo.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.