mm/memblock.c: WARN_ON when flags differs from overlap region
authorWei Yang <[email protected]>
Tue, 8 Sep 2015 21:59:53 +0000 (14:59 -0700)
committerLinus Torvalds <[email protected]>
Tue, 8 Sep 2015 22:35:28 +0000 (15:35 -0700)
Each memblock_region has flags to indicates the type of this range. For
the overlap case, memblock_add_range() inserts the lower part and leave the
upper part as indicated in the overlapped region.

If the flags of the new range differs from the overlapped region, the
information recorded is not correct.

This patch adds a WARN_ON when the flags of the new range differs from the
overlapped region.

Signed-off-by: Wei Yang <[email protected]>
Cc: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/memblock.c

index 95ce68c6da8adc0b8d4c925027a5b04b824ab381..bde61e8c28c55b6ccafd315debaa1ed74a00695c 100644 (file)
@@ -569,6 +569,7 @@ repeat:
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
                        WARN_ON(nid != memblock_get_region_node(rgn));
 #endif
+                       WARN_ON(flags != rgn->flags);
                        nr_new++;
                        if (insert)
                                memblock_insert_region(type, i++, base,