summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Čerman <ondrej.cerman@gmail.com>2019-05-26 22:43:47 +0200
committerLeandro A. F. Pereira <leandro@hardinfo.org>2019-05-26 19:11:12 -0700
commit8c4845a39d030a78422c5d2d7cbfdce91e40615a (patch)
treedb134a67e09151e03554478f3091b94b00852853
parent3b17f7164228b81ab17d41cc8ea16ba83211d043 (diff)
devices/spd-decode: DDR4 manufacturer decoding fix
-rw-r--r--modules/devices/spd-decode.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/devices/spd-decode.c b/modules/devices/spd-decode.c
index 06fb4d32..27e4593f 100644
--- a/modules/devices/spd-decode.c
+++ b/modules/devices/spd-decode.c
@@ -1593,18 +1593,19 @@ static void decode_ddr4_manufacturer(unsigned char count, unsigned char code, ch
return;
}
- if (parity(count) != 1) {
+ if (parity(count) != 1 || parity(code) != 1) {
*manufacturer = _("Invalid");
return;
}
int bank = count & 0x7f;
- if (bank >= VENDORS_BANKS || (bank == VENDORS_BANKS - 1 && code > VENDORS_LAST_BANK_SIZE)) {
+ int pos = code & 0x7f;
+ if (bank >= VENDORS_BANKS || (bank == VENDORS_BANKS - 1 && pos > VENDORS_LAST_BANK_SIZE)) {
*manufacturer = _("Unknown");
return;
}
- *manufacturer = (char *)vendors[bank][code - 1];
+ *manufacturer = (char *)vendors[bank][pos - 1];
}
static void decode_ddr4_module_manufacturer(unsigned char *bytes, int spd_size,