[coreboot-gerrit] New patch to review for coreboot: device/dram/ddr3: Fix calculation CRC16 of SPD

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Mon Nov 21 01:44:29 CET 2016


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17550

-gerrit

commit 4b8597c9a549fb0d78dcae4985dd90f4898b91f0
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Mon Nov 21 02:39:59 2016 +0200

    device/dram/ddr3: Fix calculation CRC16 of SPD
    
    Fix regression with commit:
       7dc4b84 device/dram/ddr3: Calculate CRC16 of SPD unique identifier
    
    Misplaced parenthesis causes CRC check failure, potentially
    rendering some platform unbootable.
    
    Change-Id: I9699ee2ead5b99c7f46f6f4682235aae3125cca6
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/device/dram/ddr3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/device/dram/ddr3.c b/src/device/dram/ddr3.c
index b3bcd68..6e5c541 100644
--- a/src/device/dram/ddr3.c
+++ b/src/device/dram/ddr3.c
@@ -52,7 +52,7 @@ static u16 crc16(const u8 *ptr, int n_crc)
 	u16 crc = 0;
 
 	while (--n_crc >= 0) {
-		crc = (crc ^ (int)*ptr++) << 8;
+		crc = crc ^ ((int)*ptr++ << 8);
 		for (i = 0; i < 8; ++i)
 			if (crc & 0x8000) {
 				crc = (crc << 1) ^ 0x1021;



More information about the coreboot-gerrit mailing list