Skip to content

Commit

Permalink
pata_legacy: fix a couple uninitialized variable bugs
Browse files Browse the repository at this point in the history
The last byte of "pad" is used without being initialized.

Fixes: 55dba31 ("libata: update ->data_xfer hook for ATAPI")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Damien Le Moal <[email protected]>
  • Loading branch information
Dan Carpenter authored and damien-lemoal committed Oct 12, 2021
1 parent 64570fb commit 0139234
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/ata/pata_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,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);
Expand Down Expand Up @@ -742,7 +743,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);
Expand Down

0 comments on commit 0139234

Please sign in to comment.