diff --git a/post/drivers/memory.c b/post/drivers/memory.c
index a2c088bad8d5f3cf274b4e62085e9b664f96cedd..fbc349a852fba29e7484af7c664e1bd0ebd73a13 100644
--- a/post/drivers/memory.c
+++ b/post/drivers/memory.c
@@ -461,6 +461,9 @@ int memory_post_test (int flags)
 	unsigned long memsize = (bd->bi_memsize >= 256 << 20 ?
 				 256 << 20 : bd->bi_memsize) - (1 << 20);
 
+	/* Limit area to be tested with the board info struct */
+	if (CFG_SDRAM_BASE + memsize > (ulong)bd)
+		memsize = (ulong)bd - CFG_SDRAM_BASE;
 
 	if (flags & POST_SLOWTEST) {
 		ret = memory_post_tests (CFG_SDRAM_BASE, memsize);