From nobody Mon Sep 16 19:15:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@fujitsu.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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1721293728; cv=none; d=zohomail.com; s=zohoarc; b=JH6NVt3u4F6XWfIV3fPUkbhWIaORQVJSjiRxvj+TGH39SH9ZLtm/5nPe4wp7nHlWK9j6wbfAu74s6cjlDq/5X5ehaq3qBPcXTLc6YCaOOpBnSKHxq1sbfxRr0/+jta5FjriIeJwccL5loEUsh0wRqyG1QBaGE64T9qPzNs1GCbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721293728; 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:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=qBgPRUMwpEi5JiTtPB9z2jcrNDuSMlOwUx4bh1FqVjc=; b=VED3JqIrmi7WjlFc50PwsMSRswE6q+DGgMvhvRtTbcBQ5vhSv9pHdF/gWV6LcIpNDhiACM5GsmfqWDulC6n6zg7aUCpbw2QwBRIgHEgJr/GooQGnIv9HXPgwldPGi8O2W6QeXISbfbu92bx1DmjTCl/QKqp5mq3mWVSDPUPGgJc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@fujitsu.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 1721293728505479.5124220229394; Thu, 18 Jul 2024 02:08:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sUN7W-0002Ns-K7; Thu, 18 Jul 2024 05:08:14 -0400 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 1sUN7U-0002Gm-R8 for qemu-devel@nongnu.org; Thu, 18 Jul 2024 05:08:12 -0400 Received: from esa12.hc1455-7.c3s2.iphmx.com ([139.138.37.100]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sUN7S-0005pu-Ua for qemu-devel@nongnu.org; Thu, 18 Jul 2024 05:08:12 -0400 Received: from unknown (HELO oym-r2.gw.nic.fujitsu.com) ([210.162.30.90]) by esa12.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2024 18:08:05 +0900 Received: from oym-m4.gw.nic.fujitsu.com (oym-nat-oym-m4.gw.nic.fujitsu.com [192.168.87.61]) by oym-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id 019D5D4255 for ; Thu, 18 Jul 2024 18:08:03 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id 3DCDFD52F4 for ; Thu, 18 Jul 2024 18:08:02 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id C136620086129 for ; Thu, 18 Jul 2024 18:08:01 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.225.88]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 1C47D1A000A; Thu, 18 Jul 2024 17:08:01 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1721293690; x=1752829690; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=sQE84ydqX+Xy8dQ61r646iNiJEY7sN61UA2G290//M0=; b=AYfo4el5pHHYU0e/iwfJkX0aGyWD3H6KhXpVQFnNkah6TzvXRICqDlPu +t3YDfL0z+CviqvbDclSxDD/1SEYVaMmerfpiPdb24idfw4hhmOva9G+o IQFsZg7CtUh/ijH4UcBd2gZAti38AJwEWtFBlI35VdQ6G0g3r4hi1j8gT vc7EfbrxnnTgiYsU0EbGl8RrFDilPebR0tPwTIgTUeF6vfPVcF/yOCR7l i093oLSHY7z3ud+f2S+/HdUjtjBv9ygqEJWXUgDvTLnYngx3RDyj5uPcS 6/ENb9QPhirq+Z6GyW/nSGMt2gZLSAn3vPooAFdY9jVuaCMhAuzi5EXvB Q==; X-IronPort-AV: E=McAfee;i="6700,10204,11136"; a="146763822" X-IronPort-AV: E=Sophos;i="6.09,217,1716217200"; d="scan'208";a="146763822" To: jonathan.cameron@huawei.com, fan.ni@samsung.com Cc: qemu-devel@nongnu.org, Yao Xingtao Subject: [PATCH] mem/cxl_type3: Fix overlapping region validation error Date: Thu, 18 Jul 2024 05:07:53 -0400 Message-Id: <20240718090753.59163-1-yaoxt.fnst@fujitsu.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-28536.006 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-28536.006 X-TMASE-Result: 10-0.623500-10.000000 X-TMASE-MatchedRID: WS7LLyBpFOP/R1NSMc2qCUz7FUUjXG1jwTlc9CcHMZerwqxtE531VOgV 4TkxLE0x585VzGMOFzA870o9QRfzOwtuKBGekqUpIG4YlbCDECseyhETYMxMRvr0uieWRyKF8Ts JZXzG8uKK/Gy9WLZUeX2IiP6t7Gv04XkR6BoWo5M7Duqd1O+1bXCY7NY42rmqVzS7LFez63KTpH J0MYQg3hMBexWs+SIH3D94QFatAxc21XLFpkB2YKzp5y15pXcIftwZ3X11IV0= X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 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=139.138.37.100; envelope-from=yaoxt.fnst@fujitsu.com; helo=esa12.hc1455-7.c3s2.iphmx.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, 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_PASS=-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: , Reply-to: Yao Xingtao From: Yao Xingtao via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1721293730593116600 When injecting a new poisoned region through qmp_cxl_inject_poison(), the newly injected region should not overlap with existing poisoned regions. The current validation method does not consider the following overlapping region: =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=AC=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=AC=E2=94=80=E2=94=80=E2=94=80=E2=94= =90 =E2=94=82a =E2=94=82 b(a) =E2=94=82a =E2=94=82 =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=B4=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=B4=E2=94=80=E2=94=80=E2=94=80=E2=94= =98 (a is a newly added region, b is an existing region, and b is a subregion of a) Signed-off-by: Yao Xingtao Reviewed-by: Jonathan Cameron --- hw/mem/cxl_type3.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 35ac59883a5b..8e32de327908 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1331,9 +1331,7 @@ void qmp_cxl_inject_poison(const char *path, uint64_t= start, uint64_t length, ct3d =3D CXL_TYPE3(obj); =20 QLIST_FOREACH(p, &ct3d->poison_list, node) { - if (((start >=3D p->start) && (start < p->start + p->length)) || - ((start + length > p->start) && - (start + length <=3D p->start + p->length))) { + if ((start < p->start + p->length) && (start + length > p->start))= { error_setg(errp, "Overlap with existing poisoned region not supporte= d"); return; --=20 2.37.3