All of lore.kernel.org
 help / color / mirror / Atom feed
* + memblock-fix-memblock_next_valid_pfn.patch added to -mm tree
@ 2017-03-03 22:21 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2017-03-03 22:21 UTC (permalink / raw)
  To: takahiro.akashi, paul.burton, mm-commits


The patch titled
     Subject: mm/memblock.c: fix memblock_next_valid_pfn()
has been added to the -mm tree.  Its filename is
     memblock-fix-memblock_next_valid_pfn.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/memblock-fix-memblock_next_valid_pfn.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/memblock-fix-memblock_next_valid_pfn.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/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
Subject: mm/memblock.c: fix memblock_next_valid_pfn()

Obviously, we should not access memblock.memory.regions[right] if 'right'
is outside of [0..memblock.memory.cnt>.

Fixes: b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns where possible")
Link: http://lkml.kernel.org/r/20170303023745.9104-1-takahiro.akashi@linaro.org
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/memblock.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff -puN mm/memblock.c~memblock-fix-memblock_next_valid_pfn mm/memblock.c
--- a/mm/memblock.c~memblock-fix-memblock_next_valid_pfn
+++ a/mm/memblock.c
@@ -1118,7 +1118,10 @@ unsigned long __init_memblock memblock_n
 		}
 	} while (left < right);
 
-	return min(PHYS_PFN(type->regions[right].base), max_pfn);
+	if (right == type->cnt)
+		return max_pfn;
+	else
+		return min(PHYS_PFN(type->regions[right].base), max_pfn);
 }
 
 /**
_

Patches currently in -mm which might be from takahiro.akashi@linaro.org are

memblock-fix-memblock_next_valid_pfn.patch


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

only message in thread, other threads:[~2017-03-03 22:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 22:21 + memblock-fix-memblock_next_valid_pfn.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.