From: Roland Dreier Date: Tue, 4 Nov 2008 18:34:48 +0000 (-0800) Subject: libata: Avoid overflow in ata_tf_read_block() when tf->hba_lbal > 127 X-Git-Tag: v2.6.28-rc5~88^2~1 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=44901a96847b9967c057832b185e2f34ee6a14e5;p=linux-2.6-omap-h63xx.git libata: Avoid overflow in ata_tf_read_block() when tf->hba_lbal > 127 Phillip O'Donnell pointed out that the same sign extension bug that was fixed in commit ba14a9c2 ("libata: Avoid overflow in ata_tf_to_lba48() when tf->hba_lbal > 127") also appears to exist in ata_tf_read_block(). Fix this by adding a cast to u64. Signed-off-by: Roland Dreier Signed-off-by: Jeff Garzik --- diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 0cd3ad49713..4214bfb13bb 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -612,7 +612,7 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev) if (tf->flags & ATA_TFLAG_LBA48) { block |= (u64)tf->hob_lbah << 40; block |= (u64)tf->hob_lbam << 32; - block |= tf->hob_lbal << 24; + block |= (u64)tf->hob_lbal << 24; } else block |= (tf->device & 0xf) << 24;