27/06/2022 19:52, [email protected]:
> From: Shiqi Liu <[email protected]>
> 
> As the possible failure of the malloc(), the not_checked and
> checked could be NULL pointer.
> Therefore, it should be better to check it in order to avoid
> the dereference of the NULL pointer.
> 
> Fixes: b7aaf417f93 ("raw/ioat: add bus driver for device scanning 
> automatically")
> 
> Signed-off-by: Shiqi Liu <[email protected]>
> ---
> --- a/drivers/raw/ioat/idxd_bus.c
> +++ b/drivers/raw/ioat/idxd_bus.c
> @@ -301,6 +301,10 @@ dsa_scan(void)
>               IOAT_PMD_DEBUG("%s(): found %s/%s", __func__, path, wq->d_name);
>  
>               dev = malloc(sizeof(*dev));
> +             if (dev == NULL) {
> +                     closedir(dev_dir);
> +                     return ENOMEM;

Isn't it supposed to be a negative value?



Reply via email to