From nobody Sat Nov 23 22:17:42 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1730754809; cv=none; d=zohomail.com; s=zohoarc; b=c8VVBdfF/Hbpe0VHSl7RcZ2TAUtsVyDaUBwwnNo5TcnGR+U9kMWPVKFpITE4iFsH6xC6QIXrwltWc2sxO+m0rO3P/xEJJmmkvxrAOQYygv0XAQFCoqHASusoD9G37+ZCX4SLTLmmmtYalCY4gQs5QmY/321QTesRX0xhQPaLs2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730754809; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2USYzZLIHQIzWKoyt995uWr9ICCZOVYtkrr3QOPenyA=; b=dXZb/wqpyPw2YhvljYvOUoKsGT5ef1NsLiTk31i20fBW5wbNduxe+KblqDbObVSdlX8DSw5EJz/5qr27Syc49CYNtzJ1fpi4o9sH+PC06qtyjZjgDwK2kVAV64Dyq3gbf5s72As10K/76YHhvGeG3u4vOA/rQE1D47JwPgE6gXE= 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; 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 1730754809319713.4448853519323; Mon, 4 Nov 2024 13:13:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t84Ja-00071b-C1; Mon, 04 Nov 2024 16:08:46 -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 1t84JX-0006ri-MM for qemu-devel@nongnu.org; Mon, 04 Nov 2024 16:08:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t84JW-0005U0-8e for qemu-devel@nongnu.org; Mon, 04 Nov 2024 16:08:43 -0500 Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-QCQiwaDDPV-CbojRqd2iYg-1; Mon, 04 Nov 2024 16:08:39 -0500 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-539eb3416cdso4957842e87.1 for ; Mon, 04 Nov 2024 13:08:38 -0800 (PST) Received: from redhat.com ([2.52.14.134]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd8e7f33sm194173955e9.6.2024.11.04.13.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 13:08:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730754521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2USYzZLIHQIzWKoyt995uWr9ICCZOVYtkrr3QOPenyA=; b=Udf5VWHp6RIhgLWosGU1K3cVtlU/wajSN1MCY2AXzts+n/zlBkqtdiYlk6ahJTOLJbFS+R m77731yWM5GYFGQLFnfkldhT8zO4tkdCTTe8ytDw6XEAPc7mRgnwkMmkWsFd3qLblIGfRy KPX9/ZD0mAAzEwO+sKSWS48Tjb2Qi/g= X-MC-Unique: QCQiwaDDPV-CbojRqd2iYg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730754517; x=1731359317; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2USYzZLIHQIzWKoyt995uWr9ICCZOVYtkrr3QOPenyA=; b=PC1Sbt47/GkZZfCLFHbcGr2vy9Cv8G/l9cz0uc315JxmObSB0bDEB2pdZcEqthljFM 9aiz4nXb6Mg5xrbj9UTclArYDMreewl9PWQuU2r8uv+aCchPgc4vPFc1A0dc8URSML+/ 8B27IaEZQCtpVSVtaja0D1yRkdMWW4I06JslnrNW07d9u4H8PtjXHWRgn0D70IxauVLq tzG7Z+SHwWleMePgoZPikXyrJ3CNxu1TGchjsFLZ8qjz/IAgEwg5NlgFlhy2IVwe6ZOq 6ACe+d1AhwczxNlvZfopkvMSExd5wN0Nw1/9vcUI2lA/BqQNmOdReMjlCRHef5jzYTzH 55/g== X-Gm-Message-State: AOJu0Yz8Hbr+BNTcm8pcQVv24N0Re9fscExwUAp85oSu8gZ2J5WPYbc3 ijMErQMz859yyrSFVjo+N6YW5RzeX753UYSQIGiDv5ztNgtUFJSHdsgJTtB3Ahp3jfErPZ31LGE duasS/A1hZAXSmhv2aw8LqmMyeum+WpNfxn0nHqGHEyUQCrnUosk7l4cDxtVDncAlzClTkkrieY XeLGNJHIzFvrFA4f1swW+NTMf73FD+aQ== X-Received: by 2002:a05:6512:ac5:b0:539:fda6:fa0a with SMTP id 2adb3069b0e04-53b348c382bmr16259263e87.9.1730754517099; Mon, 04 Nov 2024 13:08:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZ6ig/RTupJ5PVAb3ZQ4qG5p3//jKxQ/JhZYTkZ5CajGeMpi+3tsxQPgTzG1i4jRUCU/j+FA== X-Received: by 2002:a05:6512:ac5:b0:539:fda6:fa0a with SMTP id 2adb3069b0e04-53b348c382bmr16259243e87.9.1730754516584; Mon, 04 Nov 2024 13:08:36 -0800 (PST) Date: Mon, 4 Nov 2024 16:08:33 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Fan Ni , Davidlohr Bueso , Jonathan Cameron Subject: [PULL 45/65] cxl/cxl-mailbox-utils: Fix size check for cmd_firmware_update_get_info Message-ID: <0564019bf1d9dd76ee7d212c26cf40e73eb3a00c.1730754238.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.34, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1730754810789116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Fan Ni In the function cmd_firmware_update_get_info for handling Get FW info command (0x0200h), the vmem, pmem and DC capacity size check were incorrect. The size should be aligned to 256MiB, not smaller than 256MiB. Signed-off-by: Fan Ni Reviewed-by: Davidlohr Bueso Signed-off-by: Jonathan Cameron Message-Id: <20241101132005.26633-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-mailbox-utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 5f63099724..8bb0d2dd29 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -649,9 +649,9 @@ static CXLRetCode cmd_firmware_update_get_info(const st= ruct cxl_cmd *cmd, } QEMU_PACKED *fw_info; QEMU_BUILD_BUG_ON(sizeof(*fw_info) !=3D 0x50); =20 - if ((cxl_dstate->vmem_size < CXL_CAPACITY_MULTIPLIER) || - (cxl_dstate->pmem_size < CXL_CAPACITY_MULTIPLIER) || - (ct3d->dc.total_capacity < CXL_CAPACITY_MULTIPLIER)) { + if (!QEMU_IS_ALIGNED(cxl_dstate->vmem_size, CXL_CAPACITY_MULTIPLIER) || + !QEMU_IS_ALIGNED(cxl_dstate->pmem_size, CXL_CAPACITY_MULTIPLIER) || + !QEMU_IS_ALIGNED(ct3d->dc.total_capacity, CXL_CAPACITY_MULTIPLIER)= ) { return CXL_MBOX_INTERNAL_ERROR; } =20 --=20 MST