Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b50e56d81e0df964e9b28001d792021b109cf4f1
Commit:     b50e56d81e0df964e9b28001d792021b109cf4f1
Parent:     38ad9aebe70dc72df08851bbd1620d89329129ba
Author:     Al Viro <[EMAIL PROTECTED]>
AuthorDate: Sat Jan 12 14:16:14 2008 +0000
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Tue Jan 15 15:58:36 2008 -0500

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/ata/pata_legacy.c  |    8 +++-----
 drivers/ata/pata_qdi.c     |    8 +++-----
 drivers/ata/pata_winbond.c |    8 +++-----
 3 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 7bed8d8..17159b5 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
                        ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
 
                if (unlikely(slop)) {
-                       u32 pad;
+                       __le32 pad = 0;
                        if (write_data) {
                                memcpy(&pad, buf + buflen - slop, slop);
-                               pad = le32_to_cpu(pad);
-                               iowrite32(pad, ap->ioaddr.data_addr);
+                               iowrite32(le32_to_cpu(pad), 
ap->ioaddr.data_addr);
                        } else {
-                               pad = ioread32(ap->ioaddr.data_addr);
-                               pad = cpu_to_le16(pad);
+                               pad = 
cpu_to_le32(ioread32(ap->ioaddr.data_addr));
                                memcpy(buf + buflen - slop, &pad, slop);
                        }
                }
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index 7d4c696..a4c0e50 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -136,14 +136,12 @@ static void qdi_data_xfer(struct ata_device *adev, 
unsigned char *buf, unsigned
                        ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
 
                if (unlikely(slop)) {
-                       u32 pad;
+                       __le32 pad = 0;
                        if (write_data) {
                                memcpy(&pad, buf + buflen - slop, slop);
-                               pad = le32_to_cpu(pad);
-                               iowrite32(pad, ap->ioaddr.data_addr);
+                               iowrite32(le32_to_cpu(pad), 
ap->ioaddr.data_addr);
                        } else {
-                               pad = ioread32(ap->ioaddr.data_addr);
-                               pad = cpu_to_le32(pad);
+                               pad = 
cpu_to_le32(ioread32(ap->ioaddr.data_addr));
                                memcpy(buf + buflen - slop, &pad, slop);
                        }
                }
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index 311cdb3..7116a9e 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -104,14 +104,12 @@ static void winbond_data_xfer(struct ata_device *adev, 
unsigned char *buf, unsig
                        ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
 
                if (unlikely(slop)) {
-                       u32 pad;
+                       __le32 pad = 0;
                        if (write_data) {
                                memcpy(&pad, buf + buflen - slop, slop);
-                               pad = le32_to_cpu(pad);
-                               iowrite32(pad, ap->ioaddr.data_addr);
+                               iowrite32(le32_to_cpu(pad), 
ap->ioaddr.data_addr);
                        } else {
-                               pad = ioread32(ap->ioaddr.data_addr);
-                               pad = cpu_to_le16(pad);
+                               pad = 
cpu_to_le32(ioread32(ap->ioaddr.data_addr));
                                memcpy(buf + buflen - slop, &pad, slop);
                        }
                }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to