Skip to content
Commit 968e594a authored by Robert Hancock's avatar Robert Hancock Committed by Jeff Garzik
Browse files

libata: Don't trust current capacity values in identify words 57-58



Hanno Böck reported a problem where an old Conner CP30254 240MB hard drive
was reported as 1.1TB in capacity by libata:

http://lkml.org/lkml/2009/2/13/134

This was caused by libata trusting the drive's reported current capacity in
sectors in identify words 57 and 58 if the drive does not support LBA and the
current CHS translation values appear valid. Unfortunately it seems older
ATA specs were vague about what this field should contain and a number of drives
used values with wrong byte order or that were totally bogus. There's no
unique information that it conveys and so we can just calculate the number
of sectors from the reported current CHS values.

While we're at it, clean up this function to use named constants for the
identify word values.

Signed-off-by: default avatarRobert Hancock <hancockrwd@gmail.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent d6515e6f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment