All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [merged] mm-page_alloc-__alloc_pages_bulk-do-bounds-check-before-accessing-array.patch removed from -mm tree
@ 2021-06-27 21:54 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-06-27 21:54 UTC (permalink / raw
  To: akpm, linux, mgorman, mm-commits


The patch titled
     Subject: mm/page_alloc: __alloc_pages_bulk(): do bounds check before accessing array
has been removed from the -mm tree.  Its filename was
     mm-page_alloc-__alloc_pages_bulk-do-bounds-check-before-accessing-array.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: mm/page_alloc: __alloc_pages_bulk(): do bounds check before accessing array

In the event that somebody would call this with an already fully populated
page_array, the last loop iteration would do an access beyond the end of
page_array.

It's of course extremely unlikely that would ever be done, but this
triggers my internal static analyzer.  Also, if it really is not supposed
to be invoked this way (i.e., with no NULL entries in page_array), the
nr_populated<nr_pages check could simply be removed instead.

Link: https://lkml.kernel.org/r/20210507064504.1712559-1-linux@rasmusvillemoes.dk
Fixes: 0f87d9d30f21 ("mm/page_alloc: add an array-based interface to the bulk page allocator")
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

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

--- a/mm/page_alloc.c~mm-page_alloc-__alloc_pages_bulk-do-bounds-check-before-accessing-array
+++ a/mm/page_alloc.c
@@ -5053,7 +5053,7 @@ unsigned long __alloc_pages_bulk(gfp_t g
 	 * Skip populated array elements to determine if any pages need
 	 * to be allocated before disabling IRQs.
 	 */
-	while (page_array && page_array[nr_populated] && nr_populated < nr_pages)
+	while (page_array && nr_populated < nr_pages && page_array[nr_populated])
 		nr_populated++;
 
 	/* Use the single page allocator for one page. */
_

Patches currently in -mm which might be from linux@rasmusvillemoes.dk are



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

only message in thread, other threads:[~2021-06-27 21:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-27 21:54 [merged] mm-page_alloc-__alloc_pages_bulk-do-bounds-check-before-accessing-array.patch removed from -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.