Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pata_legacy: fix a couple uninitialized variable bugs

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

Fixes: 55dba3120fbc ("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>

authored by

Dan Carpenter and committed by
Damien Le Moal
01392347 64570fbc

+4 -2
+4 -2
drivers/ata/pata_legacy.c
··· 352 352 iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 353 353 354 354 if (unlikely(slop)) { 355 - __le32 pad; 355 + __le32 pad = 0; 356 + 356 357 if (rw == READ) { 357 358 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); 358 359 memcpy(buf + buflen - slop, &pad, slop); ··· 743 742 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 744 743 745 744 if (unlikely(slop)) { 746 - __le32 pad; 745 + __le32 pad = 0; 746 + 747 747 if (rw == WRITE) { 748 748 memcpy(&pad, buf + buflen - slop, slop); 749 749 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);