Re: [PATCH v3 4/7] hugetlb: pass *next_nid_to_alloc directly to for_each_node_mask_to_alloc

From: Gang Li
Date: Tue Jan 02 2024 - 21:23:02 EST


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.