qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lidong Chen <lidong.chen@oracle.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, berrange@redhat.com,
	liran.alon@oracle.com, liq3ea@gmail.com, armbru@redhat.com,
	darren.kenny@oracle.com, marcandre.lureau@gmail.com,
	amarkovic@wavecomp.com
Subject: Re: [Qemu-devel] [Qemu-devel PATCH v2 2/2] util/main-loop: Fix incorrect assertion
Date: Fri, 7 Jun 2019 14:36:32 -0700	[thread overview]
Message-ID: <c025cd93-0977-367f-63f7-ee3ce7c0826c@oracle.com> (raw)
In-Reply-To: <7861c01a-c658-e777-634f-9d299b7abbaa@redhat.com>

Hi Philippe,

On 6/6/2019 4:18 PM, Philippe Mathieu-Daudé wrote:
> On 6/5/19 9:15 PM, Lidong Chen wrote:
>> The check for poll_fds in g_assert() was incorrect. The correct assertion
>> should check "n_poll_fds + w->num <= ARRAY_SIZE(poll_fds)" because the
>> subsequent for-loop is doing access to poll_fds[n_poll_fds + i] where i
>> is in [0, w->num).
>>
>> Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
>> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
>> Suggested-by: Liam Merwick <liam.merwick@oracle.com>
> Ah, so this is not a plain "v2 RESEND" patch of
> https://lists.gnu.org/archive/html/qemu-devel/2019-06/msg00636.html
> since you added Peter 'Suggested-by' tag...
So,  should I resend it as v3 patch?
>> Reviewed-by: Liran Alon <liran.alon@oracle.com>
>> Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
>> Reviewed-by: Li Qiang <liq3ea@gmail.com>
> ... but then you dropped my 'Reviewed-by'. Assuming this is a typo, and
> since there is no logical change in this patch with the previous one,
> here it goes again:
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Thanks for catching that!  Sorry about it, I will add your 'Reviewed-by'.

Thanks,

Lidong

>
> Regards,
>
> Phil.
>
>> ---
>>   util/main-loop.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/util/main-loop.c b/util/main-loop.c
>> index e1e349c..a9f4e8d 100644
>> --- a/util/main-loop.c
>> +++ b/util/main-loop.c
>> @@ -422,7 +422,7 @@ static int os_host_main_loop_wait(int64_t timeout)
>>       g_main_context_prepare(context, &max_priority);
>>       n_poll_fds = g_main_context_query(context, max_priority, &poll_timeout,
>>                                         poll_fds, ARRAY_SIZE(poll_fds));
>> -    g_assert(n_poll_fds <= ARRAY_SIZE(poll_fds));
>> +    g_assert(n_poll_fds + w->num <= ARRAY_SIZE(poll_fds));
>>   
>>       for (i = 0; i < w->num; i++) {
>>           poll_fds[n_poll_fds + i].fd = (DWORD_PTR)w->events[i];
>>


  reply	other threads:[~2019-06-07 21:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05 19:15 [Qemu-devel] [Qemu-devel PATCH v2 0/2] Fix incorrect assertions in sd and main-loop Lidong Chen
2019-06-05 19:15 ` [Qemu-devel] [Qemu-devel PATCH v2 1/2] sd: Fix out-of-bounds assertions Lidong Chen
2019-06-06 23:13   ` Philippe Mathieu-Daudé
2019-06-05 19:15 ` [Qemu-devel] [Qemu-devel PATCH v2 2/2] util/main-loop: Fix incorrect assertion Lidong Chen
2019-06-06  5:27   ` Markus Armbruster
2019-06-06 23:18   ` Philippe Mathieu-Daudé
2019-06-07 21:36     ` Lidong Chen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-06-05  6:21 [Qemu-devel] [Qemu-devel PATCH v2 0/2] sd: Fix out-of-bounds assertions Lidong Chen
2019-06-05  6:21 ` [Qemu-devel] [Qemu-devel PATCH v2 2/2] util/main-loop: Fix incorrect assertion Lidong Chen
2019-06-05  6:43   ` Li Qiang
2019-06-05  8:57   ` Philippe Mathieu-Daudé
2019-06-05 17:25     ` Lidong Chen

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=c025cd93-0977-367f-63f7-ee3ce7c0826c@oracle.com \
    --to=lidong.chen@oracle.com \
    --cc=amarkovic@wavecomp.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=darren.kenny@oracle.com \
    --cc=liq3ea@gmail.com \
    --cc=liran.alon@oracle.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.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).