From nobody Tue Nov 11 05:02:34 2025 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=1560972030; cv=none; d=zoho.com; s=zohoarc; b=UAVVY316pLDIISW0e/Bcv9WbHLtl02gGWJLrG6KlAOQQBvgCafVlE/kG1w7P6imYkDN+eIO3VUJ8mulKlD8lpStv3bVF4kiQbQz7Ijh+/XBpXytdKWLhqD6I12cUv033T054dfpfNroYzWifGWfbbOYcj4ocsFZ1OupqBPPBkuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560972030; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=FMyX7Q56PvpSwjJAv/6d6l2YbogCoEDWneWU1irXiaI=; b=XtBQSUzDyZtHzwRb4UB0NutQCd6eNQ/WpnfjnHPBGi2yrszoCWtu6YKp0z1sLWqFNCuHH2LnpOKW4Srf1Gy0nOfaFJEQhPfybTnAbVJOJuox+CG9V/k5dF7HIIV9U/3K00uFnmjI1qfdctZ927CCNlO1xKDNpE9+n68TZMjnBzw= 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 1560972030664401.50113833179284; Wed, 19 Jun 2019 12:20:30 -0700 (PDT) Received: from localhost ([::1]:41258 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdg8B-0007Fj-N1 for importer@patchew.org; Wed, 19 Jun 2019 15:20:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47366) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdg4g-0005e2-8h for qemu-devel@nongnu.org; Wed, 19 Jun 2019 15:16:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdg4d-0007pl-B7 for qemu-devel@nongnu.org; Wed, 19 Jun 2019 15:16:48 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:56590) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdg4Y-0007Yb-Bq for qemu-devel@nongnu.org; Wed, 19 Jun 2019 15:16:44 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5JJ8Zgl065645; Wed, 19 Jun 2019 19:16:30 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2t7809d9f1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 19:16:30 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5JJFEpf094589; Wed, 19 Jun 2019 19:16:29 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2t7rdwtkvr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 19:16:29 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5JJGTbT008847; Wed, 19 Jun 2019 19:16:29 GMT Received: from ca-virt2-2.us.oracle.com (/10.211.11.112) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Jun 2019 12:16:28 -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 : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=+hIm15QIKJ+xsbaM2NNF5KWvBzjkV3dP0Rtjy3b/758=; b=uwm9ikb3U2o9TQQUajKxk8CoIOHlOCRYlHUDokJ7o6+mV1cMnn5+ah1KKd+ACcV2Sg4r 4Xn0Jr/KBE8gMaEHspT8+XKOij7qdYry52nYAKYXMT1JFSOdyllCF3OPn7W4qPAyPJmj fDVUyCVTiF8auUlH62msZQbzjxYTVOm5HjdCTYtHwI/bvFwSgDZxQGCmB5LcoYfo6ZFl 6rhm5LrzNgg85pz7g9QXM9Ua3RcxklwcWLIQasmdSmaSW3eIeWPkjI7VdkVs7RIJOxzh QSucyVCBaTmKQHt20iTvqUMKS3F4C2+i57rlArK3EEjc82o7eoKNWU068fdRa3bLYgVl oQ== From: Lidong Chen To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 15:14:47 -0400 Message-Id: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9293 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-1906190157 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9293 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-1906190157 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by userp2130.oracle.com id x5JJ8Zgl065645 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.86 Subject: [Qemu-devel] [Qemu-devel PATCH v3 2/2] util/main-loop: Fix incorrect assertion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, berrange@redhat.com, liq3ea@gmail.com, f4bug@amsat.org, armbru@redhat.com, lidong.chen@oracle.com, darren.kenny@oracle.com, liran.alon@oracle.com, marcandre.lureau@gmail.com, amarkovic@wavecomp.com, pbonzini@redhat.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-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 Suggested-by: Peter Maydell Suggested-by: Liam Merwick Reviewed-by: Liran Alon Reviewed-by: Darren Kenny Reviewed-by: Li Qiang Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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