Skip to content

Commit 49d6e65

Browse files
Dan Carpenterdavejiang
authored andcommitted
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: b3a8822 ("cxl/region: Consolidate cxl_decoder_kill_region() and cxl_region_detach()") Signed-off-by: Dan Carpenter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Dave Jiang <[email protected]>
1 parent 3796f29 commit 49d6e65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/cxl/core/region.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,7 @@ __cxl_decoder_detach(struct cxl_region *cxlr,
21082108
if (pos >= p->interleave_ways) {
21092109
dev_dbg(&cxlr->dev, "position %d out of range %d\n",
21102110
pos, p->interleave_ways);
2111-
return ERR_PTR(-ENXIO);
2111+
return NULL;
21122112
}
21132113

21142114
if (!p->targets[pos])

0 commit comments

Comments
 (0)