From: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
To: Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Lubomir Rintel <lkundrak-NGH9Lh4a5iE@public.gmane.org>
Subject: [PATCH v2 1/2 i2c-tools] decode-dimms: Complete check for out-of-bounds vendor ID
Date: Mon, 1 Jun 2015 09:26:14 +0200 [thread overview]
Message-ID: <20150601092614.539ebc75@endymion.delvare> (raw)
We also need to discard vendor ID 0 and to report "Unknown" if the
vendor is in a page we don't support yet.
Additionally, check that data is present at all for DDR3 modules as we
already do for pre-DDR3 modules.
---
Changes since v1:
* Added check for data presence.
eeprom/decode-dimms | 8 ++++++--
1 file changed, 6 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 09:14:30.899898763 +0200
@@ -344,8 +344,12 @@ sub manufacturer_ddr3($$)
my ($count, $code) = @_;
my $manufacturer;
- return "Invalid" if parity($code) != 1;
- return "Unknown" if ($code & 0x7F) - 1 >= @{$vendors[$count & 0x7F]};
+ return "Undefined" unless spd_written($count, $code);
+
+ 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
next reply other threads:[~2015-06-01 7:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-01 7:26 Jean Delvare [this message]
[not found] ` <20150601092614.539ebc75-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-06-01 7:27 ` [PATCH 2/2 i2c-tools] sensors-detect: Refactor manufacturer decoding Jean Delvare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150601092614.539ebc75@endymion.delvare \
--to=jdelvare-l3a5bk7wagm@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lkundrak-NGH9Lh4a5iE@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox