Re: [PATCH] mm/list_lru: Remove redundant NULL check before kfree()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/28/25 15:18, Yu-Chun Lin wrote:
> The kernel's kfree() documentation states: "If @object is NULL, no
> operation is performed." Remove checking for NULL before calling kfree().
> 
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202502250720.9ueIb7Xh-lkp@xxxxxxxxx/
> Signed-off-by: Yu-Chun Lin <eleanor15x@xxxxxxxxx>

This is already in mm-unstable:
https://lore.kernel.org/all/20250227082223.1173847-1-jingxiangzeng.cas@xxxxxxxxx/

> ---
>  mm/list_lru.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/list_lru.c b/mm/list_lru.c
> index 7d69434c70e0..7c8fb17d9027 100644
> --- a/mm/list_lru.c
> +++ b/mm/list_lru.c
> @@ -548,8 +548,7 @@ int memcg_list_lru_alloc(struct mem_cgroup *memcg, struct list_lru *lru,
>  			}
>  			xas_unlock_irqrestore(&xas, flags);
>  		} while (xas_nomem(&xas, gfp));
> -		if (mlru)
> -			kfree(mlru);
> +		kfree(mlru);
>  	} while (pos != memcg && !css_is_dying(&pos->css));
>  
>  	return xas_error(&xas);





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux