提交 44901a96 编写于 作者: R Roland Dreier 提交者: Jeff Garzik

libata: Avoid overflow in ata_tf_read_block() when tf->hba_lbal > 127

Phillip O'Donnell <phillip.odonnell@gmail.com> 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: NRoland Dreier <rolandd@cisco.com>
Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
上级 a12d6c9a
...@@ -612,7 +612,7 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev) ...@@ -612,7 +612,7 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev)
if (tf->flags & ATA_TFLAG_LBA48) { if (tf->flags & ATA_TFLAG_LBA48) {
block |= (u64)tf->hob_lbah << 40; block |= (u64)tf->hob_lbah << 40;
block |= (u64)tf->hob_lbam << 32; block |= (u64)tf->hob_lbam << 32;
block |= tf->hob_lbal << 24; block |= (u64)tf->hob_lbal << 24;
} else } else
block |= (tf->device & 0xf) << 24; block |= (tf->device & 0xf) << 24;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册