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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 11 Aug 2021 09:21:49 +0800
From:   Feng Tang <feng.tang@...el.com>
To:     Nathan Chancellor <nathan@...nel.org>
Cc:     aarcange@...hat.com, ak@...ux.intel.com, akpm@...ux-foundation.org,
        ben.widawsky@...el.com, dan.j.williams@...el.com,
        dave.hansen@...el.com, linux-api@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        mgorman@...hsingularity.net, mhocko@...e.com,
        mike.kravetz@...cle.com, rdunlap@...radead.org,
        rientjes@...gle.com, vbabka@...e.cz, ying.huang@...el.com
Subject: Re: [PATCH] mm/hugetlb: Initialize page to NULL in
 alloc_buddy_huge_page_with_mpol()

On Tue, Aug 10, 2021 at 01:06:32PM -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> mm/hugetlb.c:2162:6: warning: variable 'page' is used uninitialized
> whenever 'if' condition is false [-Wsometimes-uninitialized]
>         if (mpol_is_preferred_many(mpol)) {
>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/hugetlb.c:2172:7: note: uninitialized use occurs here
>         if (!page)
>              ^~~~
> mm/hugetlb.c:2162:2: note: remove the 'if' if its condition is always
> true
>         if (mpol_is_preferred_many(mpol)) {
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/hugetlb.c:2155:19: note: initialize the variable 'page' to silence
> this warning
>         struct page *page;
>                          ^
>                           = NULL
> 1 warning generated.
> 
> Initialize page to NULL like in dequeue_huge_page_vma() so that page is
> not used uninitialized.
> 
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>

Thanks for the catch!

In my original patch, I initialized it in one function, but overlooked
this one.

Thanks,
Feng

Powered by blists - more mailing lists