diff options
author | Mikael Pettersson <mikpe@it.uu.se> | 2007-10-31 08:21:29 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-11-03 08:46:54 -0400 |
commit | 03116d67e0973bb493fe9307e28973a24a272bcc (patch) | |
tree | 026e8d66365e7d632431e03dc6a3ed64782ed735 /drivers/ata | |
parent | 48166fd9b065005ece8ceae594c1c50b3d955a80 (diff) |
sata_promise: fix endianess bug in ASIC PRD bug workaround
The original workaround for the Promise ASIC PRD bug
contained an endianess bug which I failed to detect:
the adjustment of the last PRD entry's length field
applied host arithmetic to little-endian data, which
is incorrect on big-endian machines.
We have the length available in host-endian format, so
do the adjustment on host-endian data and then convert
and store it in the PRD entry's little-endian data field.
Thanks to an anonymous reviewer for detecting this bug.
Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/sata_promise.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 825e717bcef9..7914def54fa3 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -587,7 +587,7 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc) | |||
587 | VPRINTK("Splitting last PRD.\n"); | 587 | VPRINTK("Splitting last PRD.\n"); |
588 | 588 | ||
589 | addr = le32_to_cpu(ap->prd[idx - 1].addr); | 589 | addr = le32_to_cpu(ap->prd[idx - 1].addr); |
590 | ap->prd[idx - 1].flags_len -= cpu_to_le32(SG_COUNT_ASIC_BUG); | 590 | ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG); |
591 | VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG); | 591 | VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG); |
592 | 592 | ||
593 | addr = addr + len - SG_COUNT_ASIC_BUG; | 593 | addr = addr + len - SG_COUNT_ASIC_BUG; |