From nobody Mon Feb 9 11:01:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1655437917; cv=none; d=zohomail.com; s=zohoarc; b=jxbdNpRJ1QVNIs8wZjlFD3kd+h5oMcGzzU/8nVzp+jLv90oyTYWXRI8M2LoXw7Q19OZq7kMVYdNDqDOdvSW35WLirLsLaAiStZ4fSBEZASkMxiyjaZQLZySbrFnOut3GEjHGmeksiEZj2V6kXBGC3CMB8nHkDX+NELWxcnVilFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655437917; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=FazfRDULS9gHEN1GZhgURP/XxHUQ970WFbCev2UnvyI=; b=LqSiNky02tFyT8G9n6OUUr/QHzBqs9C58Hv9IDdiKXqLTU25ZXAlrBENAOm9Eg0YyvW5q2Lv38Bg0zwzm6zclP0EZol6CKR1j+wwEu/5anSC66+cWqFcNadSRf2fcDmLTJ9UfCQrzdxS9NOz60N4c9TMxWiHoxtNKUim4V6LSwE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655437917584597.0088402332686; Thu, 16 Jun 2022 20:51:57 -0700 (PDT) Received: from localhost ([::1]:60302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o231Y-0003ZB-FS for importer@patchew.org; Thu, 16 Jun 2022 23:51:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o230X-0002rl-0K for qemu-devel@nongnu.org; Thu, 16 Jun 2022 23:50:53 -0400 Received: from mga18.intel.com ([134.134.136.126]:17374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o230U-0004yu-9B for qemu-devel@nongnu.org; Thu, 16 Jun 2022 23:50:52 -0400 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 20:50:46 -0700 Received: from duan-server-s2600bt.bj.intel.com ([10.240.192.123]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2022 20:50:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655437850; x=1686973850; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8n0DvnNmbzPU+uyo0wJ9LEDtlQKHr9Ebt28YUEBqrnE=; b=YzDul3PzR/yP6lnX+U1X9qNV4haJl6ms67U43DOL7XDrDs5pCXN7bzuB yKneL77Fk+Rjf3ppLOf5w4PcAQwu/d3DtjkgAsWQbL/YS5/3aDW2k8Skd i1+0B8lRHaUF86lAHBZVsoHCSbYrzMdSvpet8tRaVrdrQVKJZlGUemPfp pCkgZQY8s47Q+AXO+dsxvTBHW8JNPuzviiyNmr3YG4nRCD2unPPyTba70 mUIv+No1goyLIWDHsoSXiLi0dlu2uuF/YdKpk6z8DAx2auzNAHj1fca74 ymdvxnArdPAvXozl0RA6ltZyEAOZ2QvpcJAngDVa16/PnATD1AYSGOT/u Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="262429388" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="262429388" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="641857605" From: Zhenzhong Duan To: qemu-devel@nongnu.org Cc: eric.auger@redhat.com, mst@redhat.com Subject: [PATCH] virtio-iommu: Fix the partial copy of probe request Date: Fri, 17 Jun 2022 11:43:48 +0800 Message-Id: <20220617034348.3162918-1-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=134.134.136.126; envelope-from=zhenzhong.duan@intel.com; helo=mga18.intel.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1655437917949100001 Content-Type: text/plain; charset="utf-8" The structure of probe request doesn't include the tail, this lead to a few field is missed to be copied. Currently this isn't an issue as those missed field belong to reserved field, just in case reserved field will be used in the future. By this chance, also remove a few useless code. Signed-off-by: Zhenzhong Duan --- hw/virtio/virtio-iommu.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 7c122ab95780..bc96caf37c0c 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -656,19 +656,16 @@ static int virtio_iommu_probe(VirtIOIOMMU *s, uint8_t *buf) { uint32_t ep_id =3D le32_to_cpu(req->endpoint); - size_t free =3D VIOMMU_PROBE_SIZE; ssize_t count; =20 if (!virtio_iommu_mr(s, ep_id)) { return VIRTIO_IOMMU_S_NOENT; } =20 - count =3D virtio_iommu_fill_resv_mem_prop(s, ep_id, buf, free); + count =3D virtio_iommu_fill_resv_mem_prop(s, ep_id, buf, VIOMMU_PROBE_= SIZE); if (count < 0) { return VIRTIO_IOMMU_S_INVAL; } - buf +=3D count; - free -=3D count; =20 return VIRTIO_IOMMU_S_OK; } @@ -708,7 +705,8 @@ static int virtio_iommu_handle_probe(VirtIOIOMMU *s, uint8_t *buf) { struct virtio_iommu_req_probe req; - int ret =3D virtio_iommu_iov_to_req(iov, iov_cnt, &req, sizeof(req)); + int ret =3D virtio_iommu_iov_to_req(iov, iov_cnt, &req, + sizeof(req) + sizeof(struct virtio_iommu_req_tail)); =20 return ret ? ret : virtio_iommu_probe(s, &req, buf); } --=20 2.25.1