* + mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch added to -mm tree
@ 2021-08-11 1:18 akpm
2021-08-13 16:47 ` Nathan Chancellor
0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2021-08-11 1:18 UTC (permalink / raw)
To: mm-commits, mike.kravetz, feng.tang, nathan
The patch titled
Subject: mm/hugetlb: Initialize page to NULL in alloc_buddy_huge_page_with_mpol()
has been added to the -mm tree. Its filename is
mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Nathan Chancellor <nathan@kernel.org>
Subject: 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>
---
mm/hugetlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/hugetlb.c~mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol
+++ a/mm/hugetlb.c
@@ -2088,7 +2088,7 @@ static
struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h,
struct vm_area_struct *vma, unsigned long addr)
{
- struct page *page;
+ struct page *page = NULL;
struct mempolicy *mpol;
gfp_t gfp_mask = htlb_alloc_mask(h);
int nid;
_
Patches currently in -mm which might be from nathan@kernel.org are
mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: + mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch added to -mm tree
2021-08-11 1:18 + mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch added to -mm tree akpm
@ 2021-08-13 16:47 ` Nathan Chancellor
0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2021-08-13 16:47 UTC (permalink / raw)
To: akpm, mm-commits, mike.kravetz, feng.tang
Andrew,
On 8/10/2021 6:18 PM, akpm@linux-foundation.org wrote:
> The patch titled
> Subject: mm/hugetlb: Initialize page to NULL in alloc_buddy_huge_page_with_mpol()
> has been added to the -mm tree. Its filename is
> mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch
>
> This patch should soon appear at
> https://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch
> and later at
> https://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next and is updated
> there every 3-4 working days
>
> ------------------------------------------------------
> From: Nathan Chancellor <nathan@kernel.org>
> Subject: 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>
> ---
>
> mm/hugetlb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/mm/hugetlb.c~mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol
> +++ a/mm/hugetlb.c
> @@ -2088,7 +2088,7 @@ static
> struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h,
> struct vm_area_struct *vma, unsigned long addr)
> {
> - struct page *page;
> + struct page *page = NULL;
> struct mempolicy *mpol;
> gfp_t gfp_mask = htlb_alloc_mask(h);
> int nid;
> _
>
> Patches currently in -mm which might be from nathan@kernel.org are
>
> mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch
>
Sorry for not making it clearer with a fixes tag but I did not intend
for this to be a standalone patch but rather a fixup patch for
mm-hugetlb-add-support-for-mempolicy-mpol_preferred_many-fix.patch,
which fails to initialize page in alloc_buddy_huge_page_with_mpol(). I
thought that replying inline to the thread would be enough.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-13 16:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 1:18 + mm-hugetlb-initialize-page-to-null-in-alloc_buddy_huge_page_with_mpol.patch added to -mm tree akpm
2021-08-13 16:47 ` Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).