summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lord <kernel@teksavvy.com>2010-04-07 13:52:08 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-12 14:57:10 -0700
commit4c57ef6ae19a315202f7af060f28d9880fc5d2dd (patch)
treee6438fee0ba05887f2be531f8da553d8203a7eff
parent8eaa5f76db8a81c6edf7185e89711e5ade8a5637 (diff)
libata: Fix accesses at LBA28 boundary (old bug, but nasty) (v2)
commit 45c4d015a92f72ec47acd0c7557abdc0c8a6499d upstream. Most drives from Seagate, Hitachi, and possibly other brands, do not allow LBA28 access to sector number 0x0fffffff (2^28 - 1). So instead use LBA48 for such accesses. This bug could bite a lot of systems, especially when the user has taken care to align partitions to 4KB boundaries. On misaligned systems, it is less likely to be encountered, since a 4KB read would end at 0x10000000 rather than at 0x0fffffff. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--include/linux/ata.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 4fb357312b3b..89387962f5f5 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -1000,8 +1000,8 @@ static inline int ata_ok(u8 status)
static inline int lba_28_ok(u64 block, u32 n_block)
{
- /* check the ending block number */
- return ((block + n_block) < ((u64)1 << 28)) && (n_block <= 256);
+ /* check the ending block number: must be LESS THAN 0x0fffffff */
+ return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256);
}
static inline int lba_48_ok(u64 block, u32 n_block)