public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH i2c-tools] decode-dimms: Complete check for out-of-bounds vendor ID
@ 2015-06-01  6:38 Jean Delvare
  0 siblings, 0 replies; only message in thread
From: Jean Delvare @ 2015-06-01  6:38 UTC (permalink / raw)
  To: Linux I2C; +Cc: Lubomir Rintel

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(-)

--- i2c-tools.orig/eeprom/decode-dimms	2015-06-01 08:19:59.292190666 +0200
+++ i2c-tools/eeprom/decode-dimms	2015-06-01 08:35:31.806092421 +0200
@@ -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;


-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-01  6:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-01  6:38 [PATCH i2c-tools] decode-dimms: Complete check for out-of-bounds vendor ID Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox