lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210929162538.5c1452d63e064bf9da3cc9e5@linux-foundation.org>
Date:   Wed, 29 Sep 2021 16:25:38 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Mike Rapoport <rppt@...nel.org>
Cc:     Nathan Chancellor <nathan@...nel.org>,
        Zhenguo Yao <yaozhenguo1@...il.com>, mike.kravetz@...cle.com,
        mpe@...erman.id.au, benh@...nel.crashing.org, paulus@...ba.org,
        corbet@....net, yaozhenguo@...com, willy@...radead.org,
        linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
        linux-mm@...ck.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v7] hugetlbfs: Extend the definition of hugepages
 parameter to support node allocation

On Wed, 29 Sep 2021 15:27:18 -0700 Mike Rapoport <rppt@...nel.org> wrote:

> > mm/hugetlb.c:2957:33: error: variable 'm' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized]
> >         for_each_node_mask_to_alloc(h, nr_nodes, node, &node_states[N_MEMORY]) {
> >         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > mm/hugetlb.c:1254:3: note: expanded from macro 'for_each_node_mask_to_alloc'
> >                 nr_nodes > 0 &&                                         \
> >                 ^~~~~~~~~~~~
> > mm/hugetlb.c:2974:18: note: uninitialized use occurs here
> >         INIT_LIST_HEAD(&m->list);
> >                         ^
> > mm/hugetlb.c:2957:33: note: remove the '&&' if its condition is always true
> >         for_each_node_mask_to_alloc(h, nr_nodes, node, &node_states[N_MEMORY]) {
> >                                        ^
> > mm/hugetlb.c:2942:29: note: initialize the variable 'm' to silence this warning
> >         struct huge_bootmem_page *m;
> >                                    ^
> >                                     = NULL
> > 1 error generated.
> > 
> > I am not sure if it is possible for nr_nodes to be 0 right out of the
> > gate so might be a false positive?
> 
> With nr_nodes == 0 there will be no memory in the system :)

Let's keep clang happy?

--- a/mm/hugetlb.c~hugetlbfs-extend-the-definition-of-hugepages-parameter-to-support-node-allocation-fix
+++ a/mm/hugetlb.c
@@ -2939,7 +2939,7 @@ int alloc_bootmem_huge_page(struct hstat
 	__attribute__ ((weak, alias("__alloc_bootmem_huge_page")));
 int __alloc_bootmem_huge_page(struct hstate *h, int nid)
 {
-	struct huge_bootmem_page *m;
+	struct huge_bootmem_page *m = NULL;	/* initialize for clang */
 	int nr_nodes, node;
 
 	if (nid >= nr_online_nodes)
_

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ