libatasmart-0.19-wd-fix.patch 1.1 KB

123456789101112131415161718192021222324252627
  1. Author: Phillip Susi <psusi@ubuntu.com>
  2. Subject: fix an incorrect IO error reading SMART status
  3. Description: The read SMART status command's return status
  4. was testing for a success/failure value that included 8
  5. bits that are "N/A" according to the standard, and required
  6. that they be zeros. At least some drives do not fill them
  7. with zeros, so correct this by masking off the undefined
  8. bits.
  9. Index: b/atasmart.c
  10. ===================================================================
  11. --- a/atasmart.c
  12. +++ b/atasmart.c
  13. @@ -925,10 +925,10 @@
  14. /* SAT/USB bridges truncate packets, so we only check for 4F,
  15. * not for 2C on those */
  16. if ((d->type == SK_DISK_TYPE_ATA_PASSTHROUGH_12 || cmd[3] == htons(0x00C2U)) &&
  17. - cmd[4] == htons(0x4F00U))
  18. + (cmd[4] & htons(0xFF00U)) == htons(0x4F00U))
  19. *good = TRUE;
  20. else if ((d->type == SK_DISK_TYPE_ATA_PASSTHROUGH_12 || cmd[3] == htons(0x002CU)) &&
  21. - cmd[4] == htons(0xF400U))
  22. + (cmd[4] & htons(0xFF00U)) == htons(0xF400U))
  23. *good = FALSE;
  24. else {
  25. errno = EIO;