* [PATCH 2.6.24-rc1] sata_promise: fix endianess bug in ASIC PRD bug workaround
@ 2007-10-31 12:21 Mikael Pettersson
2007-11-03 12:48 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: Mikael Pettersson @ 2007-10-31 12:21 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Alexander Sabourenkov
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>
---
Jeff: please include this fix in any backport(s) of the
ASIC PRD bug workaround.
drivers/ata/sata_promise.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -rupN linux-2.6.24-rc1/drivers/ata/sata_promise.c linux-2.6.24-rc1.sata_promise-endianess-fix/drivers/ata/sata_promise.c
--- linux-2.6.24-rc1/drivers/ata/sata_promise.c 2007-10-31 11:47:13.000000000 +0100
+++ linux-2.6.24-rc1.sata_promise-endianess-fix/drivers/ata/sata_promise.c 2007-10-31 11:47:25.000000000 +0100
@@ -585,7 +585,7 @@ static void pdc_fill_sg(struct ata_queue
VPRINTK("Splitting last PRD.\n");
addr = le32_to_cpu(ap->prd[idx - 1].addr);
- ap->prd[idx - 1].flags_len -= cpu_to_le32(SG_COUNT_ASIC_BUG);
+ ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
addr = addr + len - SG_COUNT_ASIC_BUG;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2.6.24-rc1] sata_promise: fix endianess bug in ASIC PRD bug workaround
2007-10-31 12:21 [PATCH 2.6.24-rc1] sata_promise: fix endianess bug in ASIC PRD bug workaround Mikael Pettersson
@ 2007-11-03 12:48 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2007-11-03 12:48 UTC (permalink / raw)
To: Mikael Pettersson; +Cc: linux-ide, Alexander Sabourenkov
Mikael Pettersson wrote:
> 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>
> ---
> Jeff: please include this fix in any backport(s) of the
> ASIC PRD bug workaround.
>
> drivers/ata/sata_promise.c | 2 +-
> 1 files changed, 1 insertion(+), 1 deletion(-)
>
> diff -rupN linux-2.6.24-rc1/drivers/ata/sata_promise.c linux-2.6.24-rc1.sata_promise-endianess-fix/drivers/ata/sata_promise.c
> --- linux-2.6.24-rc1/drivers/ata/sata_promise.c 2007-10-31 11:47:13.000000000 +0100
> +++ linux-2.6.24-rc1.sata_promise-endianess-fix/drivers/ata/sata_promise.c 2007-10-31 11:47:25.000000000 +0100
> @@ -585,7 +585,7 @@ static void pdc_fill_sg(struct ata_queue
> VPRINTK("Splitting last PRD.\n");
>
> addr = le32_to_cpu(ap->prd[idx - 1].addr);
> - ap->prd[idx - 1].flags_len -= cpu_to_le32(SG_COUNT_ASIC_BUG);
> + ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
> VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
>
> addr = addr + len - SG_COUNT_ASIC_BUG;
> -
applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-03 12:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-31 12:21 [PATCH 2.6.24-rc1] sata_promise: fix endianess bug in ASIC PRD bug workaround Mikael Pettersson
2007-11-03 12:48 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).