1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
From: Phillip Susi <psusi@ubuntu.com>
Date: Mon, 25 Mar 2013 07:38:36 +0100
Subject: Fix an incorrect IO error reading SMART status
The read SMART status command's return status was testing for a
success/failure value that included 8 bits that are "N/A" according to
the standard, and required that they be zeros. At least some drives do
not fill them with zeros, so correct this by masking off the undefined
bits.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61998
Bug-Ubuntu: https://launchpad.net/bugs/1143495
---
atasmart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/atasmart.c b/atasmart.c
index b054242..9244c45 100644
--- a/atasmart.c
+++ b/atasmart.c
@@ -923,10 +923,10 @@ int sk_disk_smart_status(SkDisk *d, SkBool *good) {
/* SAT/USB bridges truncate packets, so we only check for 4F,
* not for 2C on those */
if ((d->type == SK_DISK_TYPE_ATA_PASSTHROUGH_12 || cmd[3] == htons(0x00C2U)) &&
- cmd[4] == htons(0x4F00U))
+ (cmd[4] & htons(0xFF00U)) == htons(0x4F00U))
*good = TRUE;
else if ((d->type == SK_DISK_TYPE_ATA_PASSTHROUGH_12 || cmd[3] == htons(0x002CU)) &&
- cmd[4] == htons(0xF400U))
+ (cmd[4] & htons(0xFF00U)) == htons(0xF400U))
*good = FALSE;
else {
errno = EIO;
|