From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>, qemu-devel@nongnu.org
Cc: fam@euphon.net, pbonzini@redhat.com, stefanha@redhat.com,
qemu-block@nongnu.org
Subject: Re: [PATCH 0/2] qemu/queue.h: clear linked list pointers on remove
Date: Mon, 24 Feb 2020 12:54:37 +0100 [thread overview]
Message-ID: <d3fa195d-d6cc-438f-517b-676b2642df71@redhat.com> (raw)
In-Reply-To: <20200224113903.GD1896567@stefanha-x1.localdomain>
On 2/24/20 12:39 PM, Stefan Hajnoczi wrote:
> On Mon, Feb 24, 2020 at 02:55:33AM -0800, no-reply@patchew.org wrote:
>> === OUTPUT BEGIN ===
>> 1/2 Checking commit f913b2430ad3 (qemu/queue.h: clear linked list pointers on remove)
>> ERROR: do not use assignment in if condition
>> #65: FILE: include/qemu/queue.h:314:
>> + if (((head)->sqh_first = elm->field.sqe_next) == NULL) \
>>
>> total: 1 errors, 0 warnings, 59 lines checked
>
> The same pattern is used elsewhere in this file. This code comes from
> BSD and doesn't comply with QEMU's coding style.
Checkpatch is right, assigning out of the if statement makes the review
easier, and we can avoid the 'elm' null deref:
#define QSIMPLEQ_REMOVE_HEAD(head, field) do { \
- if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL)\
+ typeof((head)->sqh_first) elm = (head)->sqh_first; \
+ (head)->sqh_first = elm->field.sqe_next; \
+ if (elm == NULL) { \
(head)->sqh_last = &(head)->sqh_first; \
+ } else { \
+ elm->field.sqe_next = NULL; \
+ } \
} while (/*CONSTCOND*/0)
next prev parent reply other threads:[~2020-02-24 11:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-24 10:34 [PATCH 0/2] qemu/queue.h: clear linked list pointers on remove Stefan Hajnoczi
2020-02-24 10:34 ` [PATCH 1/2] " Stefan Hajnoczi
2020-02-24 11:51 ` Philippe Mathieu-Daudé
2020-02-25 9:01 ` Stefan Hajnoczi
2020-02-24 10:34 ` [PATCH 2/2] aio-posix: remove confusing QLIST_SAFE_REMOVE() Stefan Hajnoczi
2020-02-24 10:55 ` [PATCH 0/2] qemu/queue.h: clear linked list pointers on remove no-reply
2020-02-24 11:39 ` Stefan Hajnoczi
2020-02-24 11:54 ` Philippe Mathieu-Daudé [this message]
2020-02-25 9:05 ` Stefan Hajnoczi
2020-02-25 10:06 ` Philippe Mathieu-Daudé
2020-03-09 16:40 ` Stefan Hajnoczi
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=d3fa195d-d6cc-438f-517b-676b2642df71@redhat.com \
--to=philmd@redhat.com \
--cc=fam@euphon.net \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=stefanha@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 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).