diff options
author | Hannes Reinecke <hare@suse.de> | 2016-04-04 11:43:57 +0200 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-04-04 12:07:40 -0400 |
commit | cffd1ee991c566bca937392cfacdafbe3b7b58c6 (patch) | |
tree | f4d01350ba01ddcadc90a3bb9508cd9880cc12f4 /drivers/ata/libata-core.c | |
parent | 5e6acd1c8c4dc9a7c16208aeac3de09151ee6233 (diff) | |
download | blackbird-op-linux-cffd1ee991c566bca937392cfacdafbe3b7b58c6.tar.gz blackbird-op-linux-cffd1ee991c566bca937392cfacdafbe3b7b58c6.zip |
libata: sanitize ata_tf_read_block()
Return U64_MAX if ata_tf_read_block() could not decode the LBA
address, and do not set the information sense descriptor in
ata_gen_ata_sense() in these cases.
tj: s/(u64)-1/U64_MAX/
Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r-- | drivers/ata/libata-core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index f991f786227e..7bdb2c4e357f 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -695,7 +695,7 @@ static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev) * RETURNS: * Block address read from @tf. */ -u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev) +u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev) { u64 block = 0; @@ -720,7 +720,7 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev) if (!sect) { ata_dev_warn(dev, "device reported invalid CHS sector 0\n"); - sect = 1; /* oh well */ + return U64_MAX; } block = (cyl * dev->heads + head) * dev->sectors + sect - 1; |