From nobody Tue Nov 26 12:39:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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 ARC-Seal: i=1; a=rsa-sha256; t=1707395032; cv=none; d=zohomail.com; s=zohoarc; b=TMpcCpEAR2YNXz+k02J2873UXZsvYc8zd5e6zCG+ojbvCtutHC68LfYIx0rvSEPYdYKTESFe1X2JiI+1L3qb9UmCdeYU+zr07vdVALBXq9X+Vj52mavw6eC1xl4IKtHtwG9gtncoVWFsMA/j4eHtwdzf5rcX3KcFMs3ICRPsxn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707395032; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YQPL6G74xFIzEJSOWsuELr83BaeyVpIvYbBZVyEDTJo=; b=ZwpJHltz5kuOKBbefdXhxM8mSGc3g3+Rt0fMVBUwRZLTz19xYqbBNONBqooIe8XmgOYuXp8kYxLVi8qXBkUGOIwWCkwAs54xZvjZkQBU8OYDzAx2+x7ft6qe0IsHHdaIgPGQPUcms43hfwm6vMD56KVh6lNo3jczk9g4xLDguXw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707395032377767.0329753503855; Thu, 8 Feb 2024 04:23:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rY3Qy-0003iz-RJ; Thu, 08 Feb 2024 07:23:16 -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 1rY3Qw-0003eu-Cn; Thu, 08 Feb 2024 07:23:14 -0500 Received: from fout1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rY3Qt-0006y3-SK; Thu, 08 Feb 2024 07:23:14 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id E6DE1138009B; Thu, 8 Feb 2024 07:23:08 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 08 Feb 2024 07:23:08 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 8 Feb 2024 07:23:07 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm2; t=1707394988; x= 1707481388; bh=YQPL6G74xFIzEJSOWsuELr83BaeyVpIvYbBZVyEDTJo=; b=J XV+RZpPAErnn9mdkLlAPqA0l7XxQgg8yeHhtxq1ybaYcpA35PP/kR4B6Rfw0YmTL BbWdJXkMfOp3U0FObiwszutLGFkjWv4rIw2wCC5yUJoGbp0PqZv2X8pdMllqh2OE obGCffIyyCNJVgkiCa5/gF4fLlSOU96o8VTbx7zBerWGY6gEDfZGj3C1jKon7ZQv 7DxsGLwvLQbMTlORwEqwrtP8/nYidafbxgSEv6zn8ASxCON1zPS4ci1RRmJbmHRq brgys9CE+4n1gt61i1XVu3grD1iEnpS2gIIW+Cb+1FDDZ1+leEtZOcx4KZJwowek QWlALadqFl+A2MMH1NmhA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1707394988; x=1707481388; bh=YQPL6G74xFIzE JSOWsuELr83BaeyVpIvYbBZVyEDTJo=; b=h1p7wj5taOogoZdAdSt4FWK0iX2Or GGnomQJoUUGtA31sSYxHB9htJ+k24pbmyUjHvu0v1ePCb8JX7p7LMtQ3VnROWYym 0Rny2GB6LQi3nJnw8I032BEclyEXFl/YW02DKwwI+9VenmucMAPHiRBvRB2LFbk7 brTy7oQigKU75cWKtKamn5qa26QzWSpOmZwuqr206EGWcoRT9YFQ860Rtfoq3EYa 6metQZgrmtLI1bPYfbete4a0lLSWN3B/Rvf25wuD7P0zlwm+TMGV3/hQE+UhzFBC 354OpvKNudLyuQm/VHGZf1BVm745TP4lydBOttk9GnZQEBEfMRZ31n2rQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrtdeggdefjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkvfevofesthejredtredtjeenucfhrhhomhepmfhlrghushcu lfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrthhtvg hrnheptdehveejiefhgfegiefhfeehueeigfeugfelhfdtffevheffkefhkeegteetffet necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhtsh esihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen Date: Thu, 08 Feb 2024 13:22:48 +0100 Subject: [PATCH] hw/nvme: fix invalid check on mcl MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240208-fix-copy-mcl-check-v1-1-6f89df85f9d3@samsung.com> X-B4-Tracking: v=1; b=H4sIAJfHxGUC/x2MSQqAMAwAvyI5G6itdfuKeCgxanClBVHEv1s8D szMA4G9cIAmecDzKUH2LUKWJkCT20ZG6SODVjpXWlU4yIW0HzeutCBNTDMaV/S1NbrMbA4xPDx H65+23ft+r7hMrWQAAAA= To: Keith Busch , Klaus Jensen Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Klaus Jensen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1091; i=k.jensen@samsung.com; h=from:subject:message-id; bh=xZut6aF5lBgiX8Du3i/xTmuTF0rrbD74QbTb7C9a/cs=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGXEx6oMrnb6LxLdsjL2fsLpFv34q/veLLJgZ IFdgQXYKgF0dYkBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJlxMeqAAoJEE3hrzFt Tw3prqAH/RAja1RAGGGVweugkr63qCwXH6zKsmpa4yMRm5e4uHKXStnfSgg84WyrVeBjSXsfG+R Zt6e2MxvTsnVMkLivgAxPwSU3t5w4qHNPcgQiiBFqVHrbFh68iC/9pWUNCYT27Be+CDtS6uQ+ur /mZbt+56zn/2PuhZ8z3Qti1DUH20gPypeoLwBKAS3res7sl9vHfT0mSB80rM6NNJR82vX9SL9/7 vO12y52SKa86gHW2FIesjpk2R3Kdewb+8WJ7tBlpw6Naby88fVj825MD99Y2OVBQW9b67qDIaZH 6xY8vBrdLpXPoV/gpOBjvehz0fOPUOKhdxR1qXGgZVLMNtN1lqbVuLIb X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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=103.168.172.144; envelope-from=its@irrelevant.dk; helo=fout1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @irrelevant.dk) X-ZM-MESSAGEID: 1707395034439100002 From: Klaus Jensen The number of logical blocks within a source range is converted into a 1s based number at the time of parsing. However, when verifying the copy length we add one again, causing the check against MCL to fail in error. Fixes: 381ab99d8587 ("hw/nvme: check maximum copy length (MCL) for COPY") Signed-off-by: Klaus Jensen Reviewed-by: Minwoo Im --- hw/nvme/ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index f026245d1e9e..05c667158a3a 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -2855,7 +2855,7 @@ static inline uint16_t nvme_check_copy_mcl(NvmeNamesp= ace *ns, uint32_t nlb; nvme_copy_source_range_parse(iocb->ranges, idx, iocb->format, NULL, &nlb, NULL, NULL, NULL); - copy_len +=3D nlb + 1; + copy_len +=3D nlb; } =20 if (copy_len > ns->id_ns.mcl) { --- base-commit: 39a6e4f87e7b75a45b08d6dc8b8b7c2954c87440 change-id: 20240208-fix-copy-mcl-check-3a6d95327154 Best regards, --=20 Klaus Jensen