[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d6b8518b-9686-5766-d906-6b35edab2583@google.com>
Date: Tue, 2 Jan 2024 18:36:15 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Gang Li <gang.li@...ux.dev>
cc: David Hildenbrand <david@...hat.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Muchun Song <muchun.song@...ux.dev>,
Andrew Morton <akpm@...ux-foundation.org>,
Tim Chen <tim.c.chen@...ux.intel.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, ligang.bdlg@...edance.com
Subject: Re: [PATCH v3 4/7] hugetlb: pass *next_nid_to_alloc directly to
for_each_node_mask_to_alloc
On Wed, 3 Jan 2024, Gang Li wrote:
> On 2024/1/3 09:32, David Rientjes wrote:
> > Same error as v2:
> >
> > mm/hugetlb.c:3315:53: warning: variable 'node' is used uninitialized
> > whenever '&&' condition is false [-Wsometimes-uninitialized]
> > for_each_node_mask_to_alloc(&h->next_nid_to_alloc, nr_nodes, node,
> > &node_states[N_MEMORY]) {
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > mm/hugetlb.c:1501:3: note: expanded from macro 'for_each_node_mask_to_alloc'
> > nr_nodes > 0 && \
> > ^~~~~~~~~~~~
> > mm/hugetlb.c:3342:38: note: uninitialized use occurs here
> > list_add(&m->list, &huge_boot_pages[node]);
> > ^~~~
> > mm/hugetlb.c:3315:53: note: remove the '&&' if its condition is always true
> > for_each_node_mask_to_alloc(&h->next_nid_to_alloc, nr_nodes, node,
> > &node_states[N_MEMORY]) {
> > ^
> > mm/hugetlb.c:3310:7: warning: variable 'node' is used uninitialized whenever
> > 'if' condition is false [-Wsometimes-uninitialized]
> > if (!m)
> > ^~
> > mm/hugetlb.c:3342:38: note: uninitialized use occurs here
> > list_add(&m->list, &huge_boot_pages[node]);
> > ^~~~
> > mm/hugetlb.c:3310:3: note: remove the 'if' if its condition is always true
> > if (!m)
> > ^~~~~~~
> > mm/hugetlb.c:3304:20: note: initialize the variable 'node' to silence this
> > warning
> > int nr_nodes, node;
> > ^
> > = 0
> > 2 warnings generated.
> >
>
> How did you get those warnings? I got nothing in my compilation.
>
I'm using clang.
You spotted the issue in your earlier reply about the potentially
uninitialized use of "node" when adding to the list.
Powered by blists - more mailing lists