[PATCH 1/1] riscv: add NULL check before calling strlen in the riscv cpu's get_desc()

Leo Liang ycliang at andestech.com
Tue May 14 12:07:43 CEST 2024


On Mon, May 06, 2024 at 05:10:06PM +0800, Hanyuan Zhao wrote:
> Without the NULL check, if the devicetree that u-boot loads does not have a
> compatible property then a store access fault will be raised and force the
> machine to reset, due to the NULL pointer we passed to strlen. This commit
> adds this check and will return -ENOSPC to indicate the get_desc failed.
> 
> Signed-off-by: Hanyuan Zhao <zhaohy22 at mails.tsinghua.edu.cn>
> ---
>  drivers/cpu/riscv_cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang at andestech.com>


More information about the U-Boot mailing list