From patchwork Wed Dec 28 09:03:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chenyi Qiang X-Patchwork-Id: 1719786 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=NedgFbS5; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nhlkt5ntBz23dD for ; Wed, 28 Dec 2022 19:56:54 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pASEh-0003pm-PQ; Wed, 28 Dec 2022 03:56:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pASEe-0003ns-EE for qemu-devel@nongnu.org; Wed, 28 Dec 2022 03:56:28 -0500 Received: from mga03.intel.com ([134.134.136.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pASEc-00048h-SK for qemu-devel@nongnu.org; Wed, 28 Dec 2022 03:56:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672217786; x=1703753786; h=from:to:cc:subject:date:message-id; bh=QPQiGWEbPrvFwo+COnyvTdMfQeWkiAqIb+nq/cIt72E=; b=NedgFbS51MiAGP1zZI2rWixQq9Mi0yRI/DZOaDGSMk78r9p5U6Q1xIVM Hkgr2gHEPbmdqJPwD5YNaJxvXdQBUH7XtCwTbd9AnI7wyCnmCnuTLnLwl zHJ84HMFCu9ahcR8ncJX5dKHGzIuhFHYVfDFAY2pYWHJLG4Xpw31yf8WE k7yUEA73SR0GzvE+6oczN78r90d3wwUzpWpqW1facnEip7kL+fjMGBOh/ hFUcPR71wUeSChxqgr15fazqXe9jxnVWp7EbDw9nYu4nFuJho2uEk5ONX hNxN+NBuWinKcsouLHjLxhHieZbEChCsW1RhX+oB9G4xb3vSNFbcLZ0Cf Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="322816410" X-IronPort-AV: E=Sophos;i="5.96,280,1665471600"; d="scan'208";a="322816410" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2022 00:56:25 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="655252618" X-IronPort-AV: E=Sophos;i="5.96,280,1665471600"; d="scan'208";a="655252618" Received: from chenyi-pc.sh.intel.com ([10.239.159.43]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2022 00:56:10 -0800 From: Chenyi Qiang To: David Hildenbrand , "Michael S. Tsirkin" Cc: Chenyi Qiang , qemu-devel@nongnu.org Subject: [PATCH] virtio-mem: Fix the iterator variable in a vmem->rdl_list loop Date: Wed, 28 Dec 2022 17:03:12 +0800 Message-Id: <20221228090312.17276-1-chenyi.qiang@intel.com> X-Mailer: git-send-email 2.17.1 Received-SPF: pass client-ip=134.134.136.65; envelope-from=chenyi.qiang@intel.com; helo=mga03.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It should be the variable rdl2 to revert the already-notified listeners. Fixes: 2044969f0b ("virtio-mem: Implement RamDiscardManager interface") Signed-off-by: Chenyi Qiang Reviewed-by: Philippe Mathieu-Daudé --- hw/virtio/virtio-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index d96bde1fab..88c9c10318 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -341,7 +341,7 @@ static int virtio_mem_notify_plug(VirtIOMEM *vmem, uint64_t offset, if (ret) { /* Notify all already-notified listeners. */ QLIST_FOREACH(rdl2, &vmem->rdl_list, next) { - MemoryRegionSection tmp = *rdl->section; + MemoryRegionSection tmp = *rdl2->section; if (rdl2 == rdl) { break;