]> git.karo-electronics.de Git - karo-tx-linux.git/commit
libata: Don't trust current capacity values in identify words 57-58
authorRobert Hancock <hancockrwd@gmail.com>
Tue, 17 Feb 2009 02:15:08 +0000 (20:15 -0600)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 00:52:53 +0000 (17:52 -0700)
commite241cac7d69d6ff6555866f45cc9163fa858133b
treeb220bae8d8a266c0aacb09e664c4d222e01f1228
parentde587ff55e743e913203b5962facb2440370654a
libata: Don't trust current capacity values in identify words 57-58

commit 968e594afdbc40b4270f9d4032ae8350475749d6 upstream.

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: Robert Hancock <hancockrwd@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/ata/libata-core.c