All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Guixin Liu <kanie@linux.alibaba.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	Dave Jiang <dave.jiang@intel.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Dan Williams <djbw@kernel.org>, Ira Weiny <iweiny@kernel.org>,
	Li Ming <ming.li@zohomail.com>,
	linux-cxl@vger.kernel.org
Subject: Re: [PATCH v4 2/2] cxl/port: Fix uninitialized coordinates reported for RCDs
Date: Thu, 10 Sep 2026 22:58:24 +0100	[thread overview]
Message-ID: <20260910225825.6da05619@jic23-hlaptop> (raw)
In-Reply-To: <20260831092216.540644-3-kanie@linux.alibaba.com>

On Mon, 31 Aug 2026 17:22:16 +0800
Guixin Liu <kanie@linux.alibaba.com> wrote:

> cxl_endpoint_get_perf_coordinates() returns success for a Restricted CXL
> Device without calculating coordinates, so the caller's output array is
> left uninitialized. Callers treat it as valid and can expose the stack
> residue as access coordinates.
> 
> Initialize the coordinates to zero before returning for an RCD. Zeroing in
> the helper rather than at the caller keeps the @coord output contract the
> exported function documents.
> 
> Reported by the Sashiko review bot.
> 
> Fixes: 5d211c709059 ("cxl: Fix cxl_endpoint_get_perf_coordinate() support for RCH")
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> Reviewed-by: Richard Cheng <icheng@nvidia.com>
Makes sense.  You 'could' add an __at_least marking to the coord parameter of this
function just to make it clear this is the size (well technically the min size, but
that's fine).  Not important though and not really part of this fix.

Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

> ---
>  drivers/cxl/core/port.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index 625e4aa427db..fea43a92744c 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -2394,8 +2394,10 @@ int cxl_endpoint_get_perf_coordinates(struct cxl_port *port,
>  	 * Skip calculation for RCD. Expectation is HMAT already covers RCD case
>  	 * since RCH does not support hotplug.
>  	 */
> -	if (cxlmd->cxlds->rcd)
> +	if (cxlmd->cxlds->rcd) {
> +		memset(coord, 0, sizeof(*coord) * ACCESS_COORDINATE_MAX);
>  		return 0;
> +	}
>  
>  	/*
>  	 * Exit the loop when the parent port of the current iter port is cxl


      parent reply	other threads:[~2026-09-10 21:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  9:22 [PATCH v4 0/2] cxl: Fix uninitialized access coordinates Guixin Liu
2026-08-31  9:22 ` [PATCH v4 1/2] cxl/cdat: Fix uninitialized stack use in bandwidth gathering Guixin Liu
2026-08-31  9:45   ` sashiko-bot
2026-08-31 16:01   ` Dave Jiang
2026-09-10 21:54     ` Jonathan Cameron
2026-08-31  9:22 ` [PATCH v4 2/2] cxl/port: Fix uninitialized coordinates reported for RCDs Guixin Liu
2026-08-31 10:00   ` sashiko-bot
2026-09-10 21:58   ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260910225825.6da05619@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=djbw@kernel.org \
    --cc=iweiny@kernel.org \
    --cc=kanie@linux.alibaba.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.