[coreboot-gerrit] Patch set updated for coreboot: amd/mct/ddr3: Rework memory speed to clock value conversion logic
Timothy Pearson (tpearson@raptorengineering.com)
gerrit at coreboot.org
Tue Jan 10 21:23:11 CET 2017
Timothy Pearson (tpearson at raptorengineering.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18073
-gerrit
commit 3effce5b037612642ecd4925e838c0d4c7fc7f85
Author: Timothy Pearson <tpearson at raptorengineering.com>
Date: Mon Jan 9 14:27:09 2017 -0600
amd/mct/ddr3: Rework memory speed to clock value conversion logic
The existing DRAM clock speed to configuration value logic contained
an error resulting in a theoretical out of bounds read. While this
would not be hit on real hardware, it was prudent to clean up the
logic to avoid the associated Coverity warning.
Found-by: Coverity Scan #1347353
Change-Id: Ic3de3074f51d52be112a2d6f2d68e35dc881dd2e
Signed-off-by: Timothy Pearson <tpearson at raptorengineering.com>
---
src/northbridge/amd/amdmct/mct_ddr3/mct_d.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c b/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c
index 7b9fa65..f726345 100644
--- a/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c
+++ b/src/northbridge/amd/amdmct/mct_ddr3/mct_d.c
@@ -256,11 +256,11 @@ static uint16_t fam15h_mhz_to_memclk_config(uint16_t freq)
/* Compute the index value for the given frequency */
for (iter = 0; iter <= 0x16; iter++) {
- if (fam15h_freq_tab[iter] == freq)
+ if (fam15h_freq_tab[iter] == freq) {
+ freq = iter;
break;
+ }
}
- if (fam15h_freq_tab[iter] == freq)
- freq = iter;
if (freq == 0)
freq = 0x4;
@@ -274,11 +274,11 @@ static uint16_t fam10h_mhz_to_memclk_config(uint16_t freq)
/* Compute the index value for the given frequency */
for (iter = 0; iter <= 0x6; iter++) {
- if (fam10h_freq_tab[iter] == freq)
+ if (fam10h_freq_tab[iter] == freq) {
+ freq = iter;
break;
+ }
}
- if (fam10h_freq_tab[iter] == freq)
- freq = iter;
if (freq == 0)
freq = 0x3;
More information about the coreboot-gerrit
mailing list