Skip to content

Commit

Permalink
libata: Avoid overflow in ata_tf_read_block() when tf->hba_lbal > 127
Browse files Browse the repository at this point in the history
Phillip O'Donnell <phillip.odonnell@gmail.com> pointed out that the same
sign extension bug that was fixed in commit ba14a9c ("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 <rolandd@cisco.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Roland Dreier authored and Jeff Garzik committed Nov 11, 2008
1 parent a12d6c9 commit 44901a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 44901a9

Please sign in to comment.