linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wonhyuk Yang <vvghjk1234@gmail.com>
To: trix@redhat.com
Cc: Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>,
	Christoph Lameter <cl@linux.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH] percpu: initialize best_upa variable
Date: Mon, 17 May 2021 08:45:09 +0900	[thread overview]
Message-ID: <CAEcHRTr5TSEPX8Pigbx2O4n8rA8gO0JosDZvX9dhRh4fhi7-ig@mail.gmail.com> (raw)
In-Reply-To: <20210515180817.1751084-1-trix@redhat.com>

On Sun, May 16, 2021 at 3:08 AM <trix@redhat.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--)


  reply	other threads:[~2021-05-16 23:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15 18:08 trix
2021-05-16 23:45 ` Wonhyuk Yang [this message]
2021-05-17  2:05 ` Dennis Zhou
2021-05-17 11:06   ` Wonhyuk Yang
2021-05-17 13:17   ` Tom Rix
2021-05-17 14:39     ` Dennis Zhou
2021-05-27 20:24       ` Dennis Zhou
2021-05-27 21:09         ` Tom Rix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEcHRTr5TSEPX8Pigbx2O4n8rA8gO0JosDZvX9dhRh4fhi7-ig@mail.gmail.com \
    --to=vvghjk1234@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dennis@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tj@kernel.org \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox