qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-devel PATCH v2 2/2] util/main-loop: Fix incorrect


From: Lidong Chen
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
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

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 <address@hidden>
Suggested-by: Peter Maydell <address@hidden>
Suggested-by: Liam Merwick <address@hidden>
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 <address@hidden>
Reviewed-by: Darren Kenny <address@hidden>
Reviewed-by: Li Qiang <address@hidden>
... 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é <address@hidden>

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 via email to

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