From nobody Mon Feb 9 17:08:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1559715935; cv=none; d=zoho.com; s=zohoarc; b=eIjg2lYz8S5fw8tRSvpTswFwXCUVP5800j8LXKjx9eB3+Hx+c59VoBSJ7r5aNVRI4+bO9WBCLHcSuAemqbWNCTBKmQSP1xs9rTJWDDPTSu6/WJVaFPbm4L8t3KQNBjsaiyL1r9PpZF2gFHXEVfGCnFIMpPen+vRnokZPh3rxpu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559715935; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=DvBcQvrw2mXQCsz+/0O3D1uiaSo9CY48agW3IQWWiss=; b=Re55OidtWiIqnKRkycMlF4tKFtnBdRuCI2nleuiTausDmnP1n/6Onuo3npapYD4XXXxbZTSmF7TEEPXzKilaDT5Ujc0d5h9EBu0PaJSqs5W9jGkBrTjfdlC87ohhWXdiijaT//1NxyP9LQfxVGUE2yKIJmpBnkhiqEgLPUqEWnA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559715935461260.1848995081923; Tue, 4 Jun 2019 23:25:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:36254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYPMW-0002wu-GB for importer@patchew.org; Wed, 05 Jun 2019 02:25:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYPKX-00023A-1s for qemu-devel@nongnu.org; Wed, 05 Jun 2019 02:23:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYPKV-0001ek-Vp for qemu-devel@nongnu.org; Wed, 05 Jun 2019 02:23:25 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:43820) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYPKV-0001cw-Mv for qemu-devel@nongnu.org; Wed, 05 Jun 2019 02:23:23 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x556J8I9194306; Wed, 5 Jun 2019 06:23:21 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2suj0qgtwm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 05 Jun 2019 06:23:21 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x556L01X118603; Wed, 5 Jun 2019 06:21:21 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2swngkrb36-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 05 Jun 2019 06:21:20 +0000 Received: from abhmp0022.oracle.com (abhmp0022.oracle.com [141.146.116.28]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x556LKb7004002; Wed, 5 Jun 2019 06:21:20 GMT Received: from ca-virt2-2.us.oracle.com (/10.211.11.112) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 04 Jun 2019 23:21:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : in-reply-to : references; s=corp-2018-07-02; bh=DvBcQvrw2mXQCsz+/0O3D1uiaSo9CY48agW3IQWWiss=; b=E65sv6PJHMvbh3AgN1Kt7qKWWLN5RH53C03xY1wbrD0SstkLi8rG3KdjoloB8xYwNptM g797Neg24Z3u1pur/nAu5o5ytJPhUrIFaGIlpnseJU0gkK3I0Ap6NeesKYZiSd8NjdgF JuP3n/8Ba3RK6ABS67b45P6m5fBtVk7QiOxRYIXGAfI4ZvUX6BNhS37J1U3W51gcVI2b ESTJcVVS3df9i0BBDti6gh6VcdrmjDcMj491JcNdXi8KdBjrAsGqRbM2PNTHY+e8QlXx tNZDE79PyFz0QZtwdh+uHI5DrKJpKnOnh/ytivvosyYcUyGQemKer/3j8kH1f0+v2fnP kw== From: Lidong Chen To: qemu-devel@nongnu.org Date: Wed, 5 Jun 2019 02:21:06 -0400 Message-Id: <2410fe0d6dc7d5afdec8e3b8901b32e71ed303a5.1559710447.git.lidong.chen@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9278 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906050040 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9278 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906050040 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [Qemu-devel PATCH v2 2/2] util/main-loop: Fix incorrect assertion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, berrange@redhat.com, liran.alon@oracle.com, liq3ea@gmail.com, armbru@redhat.com, lidong.chen@oracle.com, darren.kenny@oracle.com, marcandre.lureau@gmail.com, amarkovic@wavecomp.com, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The check for poll_fds in g_assert() was incorrect. The correct assertion should check "n_poll_fds + w->num <=3D 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 Reviewed-by: Liran Alon Reviewed-by: Darren Kenny Reviewed-by: Li Qiang Reviewed-by: Philippe Mathieu-Daud=C3=A9 Suggested-by: Peter Maydell --- 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 =3D g_main_context_query(context, max_priority, &poll_timeo= ut, poll_fds, ARRAY_SIZE(poll_fds)); - g_assert(n_poll_fds <=3D ARRAY_SIZE(poll_fds)); + g_assert(n_poll_fds + w->num <=3D ARRAY_SIZE(poll_fds)); =20 for (i =3D 0; i < w->num; i++) { poll_fds[n_poll_fds + i].fd =3D (DWORD_PTR)w->events[i]; --=20 1.8.3.1