Re: [PATCH] mm/damon/sysfs: eliminate potential uninitialized variable warning

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

 



Hi Dan,

On Mon, 6 Nov 2023 17:07:40 +0300 Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:

> The "err" variable is not initialized if damon_target_has_pid(ctx) is
> false and sys_target->regions->nr is zero.

Thank you for fixing this.  I actually noticed this issue from Coverity Weekly
Scan of -next tree (CID 1570878), and was about to send very same fix, but you
were faster :)

> 
> Fixes: 0bcd216c4741 ("mm/damon/sysfs: update monitoring target regions for online input commit")

Cc stable?

> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Reviewed-by: SeongJae Park <sj@xxxxxxxxxx>


Thanks,
SJ

> ---
>  mm/damon/sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
> index e27846708b5a..1dfa96d4de99 100644
> --- a/mm/damon/sysfs.c
> +++ b/mm/damon/sysfs.c
> @@ -1172,7 +1172,7 @@ static int damon_sysfs_update_target(struct damon_target *target,
>  		struct damon_ctx *ctx,
>  		struct damon_sysfs_target *sys_target)
>  {
> -	int err;
> +	int err = 0;
>  
>  	if (damon_target_has_pid(ctx)) {
>  		err = damon_sysfs_update_target_pid(target, sys_target->pid);
> -- 
> 2.42.0
> 




[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