Skip to contentSkip to conversation

decode-dimms: Complete check for out-of-bounds vendor ID

PATCH Superseded Jean Delvare 1 participant 1 message Jun 1, 2015 I2C subsystem host drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 decode-dimms: Complete check for out-of-bounds vendor ID

We also need to discard vendor ID 0 and to report "Unknown" if the vendor is in a page we don't support yet.
---
Lubomir, this goes on top of your (modified) patch. Does it look good to you? Thanks.

 eeprom/decode-dimms |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
eeprom/decode-dimms +4 -2
@@ -344,8 +344,10 @@ sub manufacturer_ddr3($$)
 	my ($count, $code) = @_;
 	my $manufacturer;
 
-	return "Invalid" if parity($code) != 1;
-	return "Unknown" if ($code & 0x7F) - 1 >= @{$vendors[$count & 0x7F]};
+	return "Invalid" if parity($code) != 1
+			 or ($code & 0x7F) == 0;
+	return "Unknown" if ($count & 0x7F) >= @vendors
+			 or ($code & 0x7F) - 1 >= @{$vendors[$count & 0x7F]};
 	$manufacturer = $vendors[$count & 0x7F][($code & 0x7F) - 1];
 	$manufacturer =~ s/ \(former .*\)$// if $opt_side_by_side;
 	$manufacturer .= "? (Invalid parity)" if parity($count) != 1;
Signature · 2 lines
Jean Delvare
SUSE L3 Support