Re: [PATCH] mm/hugetlb: Initialize page to NULL in alloc_buddy_huge_page_with_mpol()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

Thanks for the catch!

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

Thanks,
Feng




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux