Re: drivers/cxl: suspected null pointer dereference in core/bus.c

From: Ben Widawsky
Date: Wed Oct 27 2021 - 11:04:39 EST


On 21-10-27 11:35:25, YE Chengfeng wrote:
> Hi,
>
> https://github.com/torvalds/linux/blob/master/drivers/cxl/core/bus.c#L98
>
> We notice that in multiple call sites, the return pointer of to_cxl_decoder is not null-checked, could it be a potential null-pointer-dereference problem?
>
> This is detected by our experimental static analysis tool, it could be false positive, we manually check and report those we think may be true issues. Would you like to have a look at them?
>
> Thanks so much,
> Chengfeng

add linux-cxl...

If NULL is returned, it's a driver bug. The WARN_ON and subsequent NULL deref
oops is desirable.