From: Dave Jiang <dave.jiang@intel.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
Dan Williams <dan.j.williams@intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
"Fabio M. De Francesco" <fabio.m.de.francesco@linux.intel.com>,
Robert Richter <rrichter@amd.com>, Li Ming <ming.li@zohomail.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] cxl/region: Fix an ERR_PTR() vs NULL bug
Date: Fri, 18 Jul 2025 16:27:08 -0700 [thread overview]
Message-ID: <7d9e6df5-5921-422e-9ef8-4cef3f89b555@intel.com> (raw)
In-Reply-To: <7def7da0-326a-410d-8c92-718c8963c0a2@sabinyo.mountain>
On 7/18/25 2:22 PM, Dan Carpenter wrote:
> The __cxl_decoder_detach() function is expected to return NULL on error
> but this error path accidentally returns an error pointer. It could
> potentially lead to an error pointer dereference in the caller. Change
> it to return NULL.
>
> Fixes: b3a88225519c ("cxl/region: Consolidate cxl_decoder_kill_region() and cxl_region_detach()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Thanks Dan!
Applied to cxl/next
49d6e658e758e42aaff8ae5ecdd2d06b29abf53e
> ---
> drivers/cxl/core/region.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index f0765a0af845..71cc42d05248 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -2108,7 +2108,7 @@ __cxl_decoder_detach(struct cxl_region *cxlr,
> if (pos >= p->interleave_ways) {
> dev_dbg(&cxlr->dev, "position %d out of range %d\n",
> pos, p->interleave_ways);
> - return ERR_PTR(-ENXIO);
> + return NULL;
> }
>
> if (!p->targets[pos])
prev parent reply other threads:[~2025-07-18 23:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 21:22 Dan Carpenter
2025-07-18 23:27 ` Dave Jiang [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=7d9e6df5-5921-422e-9ef8-4cef3f89b555@intel.com \
--to=dave.jiang@intel.com \
--cc=alison.schofield@intel.com \
--cc=dan.carpenter@linaro.org \
--cc=dan.j.williams@intel.com \
--cc=dave@stgolabs.net \
--cc=fabio.m.de.francesco@linux.intel.com \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=peterz@infradead.org \
--cc=rrichter@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®