projects
/
oweals
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
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 f19aeb8042790f0aacc26a0547f0968bc27e65ea..9713835bf275a0edfcf2e7bdbf2bc7b91a76ab84 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;
}