From nobody Tue Nov 4 21:34:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531490748988911.0076578619509; Fri, 13 Jul 2018 07:05:48 -0700 (PDT) Received: from localhost ([::1]:37558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdyha-0003Zj-Cr for importer@patchew.org; Fri, 13 Jul 2018 10:05:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdygY-0003Bd-Dc for qemu-devel@nongnu.org; Fri, 13 Jul 2018 10:04:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdygX-0007Hn-BZ for qemu-devel@nongnu.org; Fri, 13 Jul 2018 10:04:38 -0400 Received: from forwardcorp1o.cmail.yandex.net ([2a02:6b8:0:1a72::290]:36753) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fdygW-0007Es-Ux for qemu-devel@nongnu.org; Fri, 13 Jul 2018 10:04:37 -0400 Received: from smtpcorp1o.mail.yandex.net (smtpcorp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::30]) by forwardcorp1o.cmail.yandex.net (Yandex) with ESMTP id 1FA46216EE; Fri, 13 Jul 2018 17:04:33 +0300 (MSK) Received: from smtpcorp1o.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtpcorp1o.mail.yandex.net (Yandex) with ESMTP id 1D9E62440E01; Fri, 13 Jul 2018 17:04:33 +0300 (MSK) Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:e1bb:a1a7:a235:d6b4]) by smtpcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id WzZNFB7PEf-4X54iaxa; Fri, 13 Jul 2018 17:04:33 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1531490673; bh=4sQ7kK6CxWfJYQ7x5Cr6b/z5j9435btd+wuR1i9ED6A=; h=From:To:Cc:Subject:Date:Message-Id; b=BZQkdEiI0Mpuj8CnMaa4vVWrJhxi1mfhjTMQPmRid/bGBdLdhNr49w9BNZjZg8i6Z pA0DLgTkr8TPcUVLyoDll4WKlGZ18iPYUKP+lvdpGGBBkJyIri3hgzPIywsI8Br8p1 EGPiY2KSCVJF9q91YYhY/1SHtR4dDh1v+PhlpGPc= Authentication-Results: smtpcorp1o.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Yury Kotov To: qemu-devel@nongnu.org Date: Fri, 13 Jul 2018 17:04:05 +0300 Message-Id: <1531490645-10989-1-git-send-email-yury-kotov@yandex-team.ru> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:6b8:0:1a72::290 Subject: [Qemu-devel] [PATCH] vhost: fix invalid downcast 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: wrfsh@yandex-team.ru, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" virtio_queue_get_desc_addr returns 64-bit hwaddr while int is usually 32-bi= t. If returned hwaddr is not equal to 0 but least-significant 32 bits are equal to 0 then this code will not actually stop running queue. Signed-off-by: Yury Kotov Acked-by: Jia He --- hw/virtio/vhost.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index b129cb9..7edeee7 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1071,10 +1071,8 @@ static void vhost_virtqueue_stop(struct vhost_dev *d= ev, .index =3D vhost_vq_index, }; int r; - int a; =20 - a =3D virtio_queue_get_desc_addr(vdev, idx); - if (a =3D=3D 0) { + if (virtio_queue_get_desc_addr(vdev, idx) =3D=3D 0) { /* Don't stop the virtqueue which might have not been started */ return; } --=20 2.7.4