lkml.org 
[lkml]   [2021]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.14 118/151] pata_legacy: fix a couple uninitialized variable bugs
    Date
    From: Dan Carpenter <dan.carpenter@oracle.com>

    commit 013923477cb311293df9079332cf8b806ed0e6f2 upstream.

    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>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/ata/pata_legacy.c | 6 ++++--
    1 file changed, 4 insertions(+), 2 deletions(-)

    --- a/drivers/ata/pata_legacy.c
    +++ b/drivers/ata/pata_legacy.c
    @@ -352,7 +352,8 @@ static unsigned int pdc_data_xfer_vlb(st
    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);
    @@ -742,7 +743,8 @@ static unsigned int vlb32_data_xfer(stru
    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);

    \
     
     \ /
      Last update: 2021-10-18 16:00    [W:4.454 / U:0.116 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site