diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2008-01-12 09:16:14 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-01-15 15:58:36 -0500 |
commit | b50e56d81e0df964e9b28001d792021b109cf4f1 (patch) | |
tree | e76679a3230265d1484882fd914e1b7b208004ba /drivers/ata/pata_legacy.c | |
parent | 38ad9aebe70dc72df08851bbd1620d89329129ba (diff) |
libata fixes for sparse-found problems
In pata_legacy and pata_winbond we've got bugs - cpu_to_le16() instead
of cpu_to_le32(). Fortunately, both affected suckers are VLB, thus
l-e-only, so we might get away with that unless we hit it with slop == 3
(hadn't checked if playing with badly aligned sg could trigger that).
Still buggy... Moreover, pata_legacy, pata_winbond and pata_qdi forgot to
initialize pad on the write side of 32bit case in their ->data_xfer().
Hopefully the hardware does't care, but still, sending uninitialized
data to it...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_legacy.c')
-rw-r--r-- | drivers/ata/pata_legacy.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index 7bed8d806381..17159b5e1e43 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
@@ -271,14 +271,12 @@ static void pdc_data_xfer_vlb(struct ata_device *adev, unsigned char *buf, unsig | |||
271 | ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); | 271 | ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); |
272 | 272 | ||
273 | if (unlikely(slop)) { | 273 | if (unlikely(slop)) { |
274 | u32 pad; | 274 | __le32 pad = 0; |
275 | if (write_data) { | 275 | if (write_data) { |
276 | memcpy(&pad, buf + buflen - slop, slop); | 276 | memcpy(&pad, buf + buflen - slop, slop); |
277 | pad = le32_to_cpu(pad); | 277 | iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); |
278 | iowrite32(pad, ap->ioaddr.data_addr); | ||
279 | } else { | 278 | } else { |
280 | pad = ioread32(ap->ioaddr.data_addr); | 279 | pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); |
281 | pad = cpu_to_le16(pad); | ||
282 | memcpy(buf + buflen - slop, &pad, slop); | 280 | memcpy(buf + buflen - slop, &pad, slop); |
283 | } | 281 | } |
284 | } | 282 | } |