Skip to content

Commit d1f4b09

Browse files
palitrini
authored andcommitted
common/memsize.c: Check for overflow in get_effective_memsize() only for mpc85xx
This reverts commit 777aaaa ("common/memsize.c: Fix get_effective_memsize() to check for overflow") for non-mpc85xx platforms. The changes to this generic function, which is intended to help with 32bit platforms with large amounts of memory has unintended side effects (which in turn lead to boot failures) on other platforms which were previously functional. For now do overflow check only for powerpc mpc85xx platform. It is needed to prevent crashing of P1/P2 boards with 4GB DDR module in 32-bit mode. Fixes: 777aaaa ("common/memsize.c: Fix get_effective_memsize() to check for overflow") Signed-off-by: Pali Rohár <[email protected]>
1 parent be914b0 commit d1f4b09

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

common/memsize.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ phys_size_t __weak get_effective_memsize(void)
9696
{
9797
phys_size_t ram_size = gd->ram_size;
9898

99+
#ifdef CONFIG_MPC85xx
99100
/*
100101
* Check for overflow and limit ram size to some representable value.
101102
* It is required that ram_base + ram_size must be representable by
@@ -105,6 +106,7 @@ phys_size_t __weak get_effective_memsize(void)
105106
*/
106107
if (gd->ram_base + ram_size < gd->ram_base)
107108
ram_size = ((phys_size_t)~0xfffULL) - gd->ram_base;
109+
#endif
108110

109111
#ifndef CONFIG_MAX_MEM_MAPPED
110112
return ram_size;

0 commit comments

Comments
 (0)