All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-memblock-fix-potential-issue-in-memblock_search_pfn_nid.patch added to -mm tree
@ 2018-03-30 20:58 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2018-03-30 20:58 UTC (permalink / raw)
  To: hejianet, mhocko, mm-commits, richard.weiyang, stable, yinghai


The patch titled
     Subject: mm/memblock: fix potential issue in memblock_search_pfn_nid()
has been added to the -mm tree.  Its filename is
     mm-memblock-fix-potential-issue-in-memblock_search_pfn_nid.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-memblock-fix-potential-issue-in-memblock_search_pfn_nid.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-memblock-fix-potential-issue-in-memblock_search_pfn_nid.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: Wei Yang <richard.weiyang@gmail.com>
Subject: mm/memblock: fix potential issue in memblock_search_pfn_nid()

memblock_search_pfn_nid() returns the nid and the [start|end]_pfn of the
memory region where pfn sits in. While the calculation of start_pfn has
potential issue when the regions base is not page aligned.

For example, we assume PAGE_SHIFT is 12 and base is 0x1234. Current
implementation would return 1 while this is not correct.

This patch fixes this by using PFN_UP().

The original commit is commit e76b63f80d93 ("memblock, numa: binary search
node id") and merged in v3.12.

Link: http://lkml.kernel.org/r/20180330033055.22340-1-richard.weiyang@gmail.com
Fixes: e76b63f80d93 ("memblock, numa: binary search node id") 
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Jia He <hejianet@gmail.com>
Cc: <stable@vger.kernel.org>	[3.12+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/memblock.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN mm/memblock.c~mm-memblock-fix-potential-issue-in-memblock_search_pfn_nid mm/memblock.c
--- a/mm/memblock.c~mm-memblock-fix-potential-issue-in-memblock_search_pfn_nid
+++ a/mm/memblock.c
@@ -1646,7 +1646,7 @@ int __init_memblock memblock_search_pfn_
 	if (mid == -1)
 		return -1;
 
-	*start_pfn = PFN_DOWN(type->regions[mid].base);
+	*start_pfn = PFN_UP(type->regions[mid].base);
 	*end_pfn = PFN_DOWN(type->regions[mid].base + type->regions[mid].size);
 
 	return type->regions[mid].nid;
_

Patches currently in -mm which might be from richard.weiyang@gmail.com are

mm-check-__highest_present_sectioin_nr-directly-in-memory_dev_init.patch
mm-memblock-fix-potential-issue-in-memblock_search_pfn_nid.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-30 20:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-30 20:58 + mm-memblock-fix-potential-issue-in-memblock_search_pfn_nid.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.