Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp75414rdb; Tue, 19 Dec 2023 09:44:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZxh7UMkSxbSzzqKrXIazX0fjqXOQpxDVi+WGDjfHQPwvyATvJG2PmhCel0rkjaLMpfGWF X-Received: by 2002:a17:906:cc54:b0:a1d:8d09:d07d with SMTP id mm20-20020a170906cc5400b00a1d8d09d07dmr1249343ejb.47.1703007866225; Tue, 19 Dec 2023 09:44:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703007866; cv=none; d=google.com; s=arc-20160816; b=Zitk8Of9sUJqX0YfnQpRBTcOYxKvOFHWQEvSKrOqPZzaW0gLt3nvCo+43pa9nRPT4M GBUyJhqxpJkJgTGy+SBfwAHleQYAkEVqsB+L0j52+Gh616NvlwbjkKrGEpzYy0dq9ZYa Au/davNVLOXNwXv0/DJqiUThWpw8QgUD0B2Qb8rY0hKhyhbHv3l5LnJCXU0/9/orEPHv q/vS3b0MgZAx0BUUNDHA9pspz0aLtcdcEcbCkConlh8jMzCozVHHnacqAcFd3TRBSLJz H5LfCeytI9aPhSAtcXtkzIzkpgk/kq0LlK355kIGYN+sVgALvX8ylP8Ykzeyf9awspUj iGaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:date:from:dkim-signature; bh=mVKQ0en2H6Uqfs9Vm0NJFXhFRX26npxXU+VQ3IHe6pk=; fh=izqkxUKWNx95eKb1pCiUAdDVqoDa+g5QT54U+H9kavM=; b=x6rI9nze9mIOUGxbmxz4ol3IXbAb0B1zHSuPJ0tGR5gkWTm+8K6vQlbgcJymg2LZ6Q A5LMEInqrQDBtjgglfHFLLDb11J8SNYJagpzKH1EuSbJsj/YPReaK0gsmaU369ikSFc5 sgzEFTaL/5lHjXUTIThPMieHoUd9DuQ4hmuJ9OmCTTstWYJQnEe06Q0iM7uGlucgrxid JR1VZnSN05UTmz0Sveen7pmFXqYuLQlnWI+b7NvZ4i/1nKZihK04F5Ongp3t0Ld/8H+t YqM/mEarT+vNT510TdueyAyyK6WdUDeXOpag0JSycmiLVAYM7bxgcUqbH5CspCsjLM5b q+og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=P+6S1bPD; spf=pass (google.com: domain of linux-kernel+bounces-5711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f3-20020a170906494300b00a1b76ecb58fsi10750521ejt.204.2023.12.19.09.44.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:44:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=P+6S1bPD; spf=pass (google.com: domain of linux-kernel+bounces-5711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E73201F2852E for ; Tue, 19 Dec 2023 17:44:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C742347DF; Tue, 19 Dec 2023 17:44:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P+6S1bPD" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CD7C31755; Tue, 19 Dec 2023 17:44:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6d7f1109abcso1563124b3a.3; Tue, 19 Dec 2023 09:44:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703007855; x=1703612655; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=mVKQ0en2H6Uqfs9Vm0NJFXhFRX26npxXU+VQ3IHe6pk=; b=P+6S1bPD8lEDxTHBT4hoUYq9VFeY34c8byLXnyJYzemfruniFxl6xqNJfjL8tflrn7 mO8iA/3a8CNpxCxoqUffyAvOxuSssEa8DyqQy6rOEsesSFUjAubFknnOqjxRkZ/z2MKy 3drWMV2afhS7meMEs6JvulD7tedwtS/6oxfzxiHiaYb1LK2w+fb0fOSkcIYQAsiZLHaD QV6kugfyGNyELk1QAmBSCArzTy9DU8ESrlfErkiFE+Yh9UqN6MaRWgLfIAoMw8G8ktXw Jcmlf3apoGq3S12rdTxvOrZzCuvuKAif1eZ1opw0YkKEsRR87HNWD9hUOl0VK2yrwkWT nWMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703007855; x=1703612655; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mVKQ0en2H6Uqfs9Vm0NJFXhFRX26npxXU+VQ3IHe6pk=; b=gcsxj4qeMRTTIBst92yKulh1O3Qy+fasD7yTkbkf+yVRo3dYX/H8jN4m5NsxLUERYM T/vB5Urd6GqqKdBkZHl4MzVU9NE2xcu+T+ykGqEfGeFC2B2VW1keUe7Y2LNlFqdme6Pq MSyiWv9Rq7tAPPoQlNZ7rZqR8xd5mbVkrvr9hGci5Na6Wx5ckZVT0YhE+24IbG14Mll4 BMLAmMQZOERD7HLbJYcNm3bFi3EtzRUBhpFdIVXpsPHAiGEPxyL8CUZUfdDCtHNkJ6pO +Y1ZYRHlt9qmLO9tzBLxY97tB07dDXot99UtVChEWFhneeRjfuRwYIwtihDVawvq8B4v pBMA== X-Gm-Message-State: AOJu0YyV8MsYc38UC7OHVtUZqj6AC6H2KOxUMBpYnhbftvQSAgRNIwTS bCwH0QqIgh63P2y7QfddPCc= X-Received: by 2002:aa7:8b12:0:b0:6d2:65bd:a16a with SMTP id f18-20020aa78b12000000b006d265bda16amr4273532pfd.18.1703007855268; Tue, 19 Dec 2023 09:44:15 -0800 (PST) Received: from debian ([177.240.14.150]) by smtp.gmail.com with ESMTPSA id h14-20020a056a00218e00b006d7dd95064fsm3816052pfi.220.2023.12.19.09.44.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:44:14 -0800 (PST) From: fan X-Google-Original-From: fan Date: Tue, 19 Dec 2023 09:44:06 -0800 To: Ira Weiny Cc: Jonathan Cameron , Fan Ni , Dave Jiang , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, Huai-Cheng Kuo Subject: Re: [PATCH v2 1/2] cxl/cdat: Handle cdat table build errors Message-ID: References: <20231117-fix-cdat-cs-v2-0-715399976d4d@intel.com> <20231117-fix-cdat-cs-v2-1-715399976d4d@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231117-fix-cdat-cs-v2-1-715399976d4d@intel.com> On Wed, Nov 29, 2023 at 05:33:03PM -0800, Ira Weiny wrote: > The callback for building CDAT tables may return negative error codes. > This was previously unhandled and will result in potentially huge > allocations later on in ct3_build_cdat() > > Detect the negative error code and defer cdat building. > > Fixes: f5ee7413d592 ("hw/mem/cxl-type3: Add CXL CDAT Data Object Exchange") > Cc: Huai-Cheng Kuo > Reviewed-by: Dave Jiang > Signed-off-by: Ira Weiny > --- > hw/cxl/cxl-cdat.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/cxl/cxl-cdat.c b/hw/cxl/cxl-cdat.c > index 639a2db3e17b..24829cf2428d 100644 > --- a/hw/cxl/cxl-cdat.c > +++ b/hw/cxl/cxl-cdat.c > @@ -63,7 +63,7 @@ static void ct3_build_cdat(CDATObject *cdat, Error **errp) > cdat->built_buf_len = cdat->build_cdat_table(&cdat->built_buf, > cdat->private); > > - if (!cdat->built_buf_len) { > + if (cdat->built_buf_len <= 0) { > /* Build later as not all data available yet */ > cdat->to_update = true; > return; > The fix looks good to me. Just curious how to really build cdat table again when an error occurs, for example, the memory allocation fails. Fan > -- > 2.42.0 >