[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEcHRTr5TSEPX8Pigbx2O4n8rA8gO0JosDZvX9dhRh4fhi7-ig@mail.gmail.com>
Date: Mon, 17 May 2021 08:45:09 +0900
From: Wonhyuk Yang <vvghjk1234@...il.com>
To: trix@...hat.com
Cc: Dennis Zhou <dennis@...nel.org>, Tejun Heo <tj@...nel.org>,
Christoph Lameter <cl@...ux.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] percpu: initialize best_upa variable
On Sun, May 16, 2021 at 3:08 AM <trix@...hat.com> wrote:
> Static analysis reports this problem
> percpu.c:2945:6: warning: Assigned value is garbage or undefined
> upa = best_upa;
> ^ ~~~~~~~~
> best_upa may not be set, so initialize it.
Hi,
Actually, best_upa is always set in the for loop below. when upa is 1,
It will always satisfy all conditions.
> diff --git a/mm/percpu.c b/mm/percpu.c
> index a257c3efdf18b..6578b706fae81 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -2916,6 +2916,7 @@ static struct pcpu_alloc_info * __init __flatten pcpu_build_alloc_info(
> * Related to atom_size, which could be much larger than the unit_size.
> */
> last_allocs = INT_MAX;
> + best_upa = max_upa;
> for (upa = max_upa; upa; upa--) {
> int allocs = 0, wasted = 0;
It doesn't seem to be a problem. But, how about this?
best_upa = 1;
for (upa = max_upa; upa>1; upa--)
Powered by blists - more mailing lists