mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
cxl/region: Fix an ERR_PTR() vs NULL bug
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: b3a8822551
("cxl/region: Consolidate cxl_decoder_kill_region() and cxl_region_detach()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/7def7da0-326a-410d-8c92-718c8963c0a2@sabinyo.mountain
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
This commit is contained in:
parent
3796f2985c
commit
49d6e658e7
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user