projects
/
platform
/
kernel
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
780e31e
)
imx: mx7: fix potential overflow in imx_ddr_size()
author
Marcel Ziswiler
<marcel.ziswiler@toradex.com>
Wed, 19 Sep 2018 11:01:55 +0000
(13:01 +0200)
committer
Stefano Babic
<sbabic@denx.de>
Tue, 9 Oct 2018 16:32:47 +0000
(18:32 +0200)
The imx_ddr_size() function may overflow as it is possible to kind of
over provision the DDR controller. Fix this by capping it to 2 GB which
is the maximum allowed size as per reference manual.
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
arch/arm/mach-imx/mx7/ddr.c
patch
|
blob
|
history
diff --git
a/arch/arm/mach-imx/mx7/ddr.c
b/arch/arm/mach-imx/mx7/ddr.c
index
f19aeb8
..
9713835
100644
(file)
--- a/
arch/arm/mach-imx/mx7/ddr.c
+++ b/
arch/arm/mach-imx/mx7/ddr.c
@@
-196,5
+196,9
@@
unsigned int imx_ddr_size(void)
if (field_val <= 29)
bits++;
+ /* cap to max 2 GB */
+ if (bits > 31)
+ bits = 31;
+
return 1 << bits;
}