]> git.baikalelectronics.ru Git - kernel.git/commitdiff
pata_legacy: fix a couple uninitialized variable bugs
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 6 Oct 2021 07:34:19 +0000 (10:34 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Oct 2021 09:40:16 +0000 (11:40 +0200)
commit 013923477cb311293df9079332cf8b806ed0e6f2 upstream.

The last byte of "pad" is used without being initialized.

Fixes: fc3bf4da247c ("libata: update ->data_xfer hook for ATAPI")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ata/pata_legacy.c

index 4fd12b20df239595e3e49ed98db68a1ac88d72c5..d91ba47f2fc44db4c23ba48d9cd3a00ae00269bc 100644 (file)
@@ -315,7 +315,8 @@ static unsigned int pdc_data_xfer_vlb(struct ata_queued_cmd *qc,
                        iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
 
                if (unlikely(slop)) {
-                       __le32 pad;
+                       __le32 pad = 0;
+
                        if (rw == READ) {
                                pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
                                memcpy(buf + buflen - slop, &pad, slop);
@@ -705,7 +706,8 @@ static unsigned int vlb32_data_xfer(struct ata_queued_cmd *qc,
                        ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
 
                if (unlikely(slop)) {
-                       __le32 pad;
+                       __le32 pad = 0;
+
                        if (rw == WRITE) {
                                memcpy(&pad, buf + buflen - slop, slop);
                                iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);