]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/hugetlb: Initialize page to NULL in alloc_buddy_huge_page_with_mpol()
authorNathan Chancellor <nathan@kernel.org>
Mon, 23 Aug 2021 23:59:35 +0000 (09:59 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Aug 2021 23:34:15 +0000 (09:34 +1000)
commitb0eb7fcac8514917091fb0d6c3e87fab53ce5df4
treef2e92cddb0813c04a84d9430bb2568a8d320542d
parent9a994fbdc0a516ffbef5a26edaaae7f9d31071a7
mm/hugetlb: Initialize page to NULL in alloc_buddy_huge_page_with_mpol()

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.

Link: https://lkml.kernel.org/r/20210810200632.3812797-1-nathan@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Feng Tang <feng.tang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
mm/hugetlb.c