ata: libata-sff: fix reading uninitialized variable in ata_sff_lost_interrupt()
PATCH 1/1 ata: libata-sff: fix reading uninitialized variable in ata_sff_lost_interrupt()
Due to my sloppy coding in commit 2c75a451ecb0 ("ata: libata-sff: refactor ata_sff_altstatus()"), in ata_sff_lost_interrupt() iff the device control register doesn't exists, ata_port_warn() would print the 'status' variable
which never gets assigned. Restore the original order of the statements,
wrapping the ata_sff_altstatus() call in WARN_ON_ONCE()...
While at it, fix crazy indentation in the ata_port_warn() call itself...
--- drivers/ata/libata-sff.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/ata/libata-sff.c +4 -3
@@ -1644,13 +1644,14 @@ void ata_sff_lost_interrupt(struct ata_preturn ;/* See if the controller thinks it is still busy - if so the command isn't a lost IRQ but is still in progress */ -if (ata_sff_altstatus (ap, &status) && (status &ATA_BUSY )) +if (WARN_ON_ONCE (!ata_sff_altstatus (ap, &status))) +return ; +if (status &ATA_BUSY )return ;/* There was a command running, we are no longer busy and we have no interrupt. */ -ata_port_warn (ap,"lost interrupt (Status 0x%x)\n" , - status); +ata_port_warn (ap,"lost interrupt (Status 0x%x)\n" , status);/* Run the host interrupt logic as if the interrupt had not been lost */ ata_sff_port_intr (ap, qc);
Quoted 6 lines · Sergey Shtylyov
Due to my sloppy coding in commit
2c75a451ecb0("ata: libata-sff: refactorata_sff_altstatus()"), inata_sff_lost_interrupt()iff the device control register doesn't exists,ata_port_warn()would print the 'status' variable
which never gets assigned. Restore the original order of the statements,
wrapping theata_sff_altstatus()call inWARN_ON_ONCE()...
Quoted 8 lines
While at it, fix crazy indentation in the
ata_port_warn()call itself...Fixes 2c75a451ecb0 ("ata: libata-sff: refactor ata_sff_altstatus()")Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Sergey Shtylyov <[email protected]>---
Forgot to mention that it's against the 'for-next' branch of 'libata.git'. :-/
[...]
MBR, Sergey
Quoted 10 lines · Sergey Shtylyov
Quoted 8 lines · Sergey Shtylyov
Due to my sloppy coding in commit
2c75a451ecb0("ata: libata-sff: refactorata_sff_altstatus()"), inata_sff_lost_interrupt()iff the device control register doesn't exists,ata_port_warn()would print the 'status' variable
which never gets assigned. Restore the original order of the statements,
wrapping theata_sff_altstatus()call inWARN_ON_ONCE()...While at it, fix crazy indentation in the
ata_port_warn()call itself...
Quoted 8 lines
Quoted 6 lines
Fixes 2c75a451ecb0 ("ata: libata-sff: refactor ata_sff_altstatus()")Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Sergey Shtylyov <[email protected]>---
Forgot to mention that it's against the 'for-next' branch of 'libata.git'. :-/
No need to mention it, it always should be :)
Quoted 4 lines
[...]
MBR, Sergey
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 6 lines · Sergey Shtylyov
Due to my sloppy coding in commit
2c75a451ecb0("ata: libata-sff: refactorata_sff_altstatus()"), inata_sff_lost_interrupt()iff the device control register doesn't exists,ata_port_warn()would print the 'status' variable
which never gets assigned. Restore the original order of the statements,
wrapping theata_sff_altstatus()call inWARN_ON_ONCE()...
Quoted 6 lines
While at it, fix crazy indentation in the
ata_port_warn()call itself...Fixes 2c75a451ecb0 ("ata: libata-sff: refactor ata_sff_altstatus()")Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Sergey Shtylyov <[email protected]>
I squashed this in the commit being fixed.
Dan,
Thanks for the report !
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 6 lines · Damien Le Moal
Quoted 6 lines
Due to my sloppy coding in commit
2c75a451ecb0("ata: libata-sff: refactorata_sff_altstatus()"), inata_sff_lost_interrupt()iff the device control register doesn't exists,ata_port_warn()would print the 'status' variable
which never gets assigned. Restore the original order of the statements,
wrapping theata_sff_altstatus()call inWARN_ON_ONCE()...
Quoted 8 lines
Quoted 6 lines
While at it, fix crazy indentation in the
ata_port_warn()call itself...Fixes 2c75a451ecb0 ("ata: libata-sff: refactor ata_sff_altstatus()")Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Sergey Shtylyov <[email protected]>I squashed this in the commit being fixed.
I'm seeing a few typos/errors in the updated patch #2:
Quoted 1 line
In
ata_sff_lost_interrupt(), wrap theata_sff_altstatus()call in a
s/a/the/?
Quoted 1 line
WARN_ON_ONCE()
+ check?
Quoted 1 line
to issue a warning if the if the device control registert
Register? :-)
Quoted 2 lines
does not exist. And while at it, fix crazy indentation in the
ata_port_warn()call itself...
Not clear why you (we?) emphasize this by using "itself"...
Well, if you choose to fix those, I'll be thnakful. But you may as well
ignore me. :-)
[...]
MBR, Sergey
Quoted 31 lines · Sergey Shtylyov
Quoted 6 lines · Damien Le Moal
Quoted 6 lines
Due to my sloppy coding in commit
2c75a451ecb0("ata: libata-sff: refactorata_sff_altstatus()"), inata_sff_lost_interrupt()iff the device control register doesn't exists,ata_port_warn()would print the 'status' variable
which never gets assigned. Restore the original order of the statements,
wrapping theata_sff_altstatus()call inWARN_ON_ONCE()...Quoted 8 lines
Quoted 6 lines
While at it, fix crazy indentation in the
ata_port_warn()call itself...Fixes 2c75a451ecb0 ("ata: libata-sff: refactor ata_sff_altstatus()")Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Sergey Shtylyov <[email protected]>I squashed this in the commit being fixed.
I'm seeing a few typos/errors in the updated patch #2:
Quoted 1 line
In
ata_sff_lost_interrupt(), wrap theata_sff_altstatus()call in as/a/the/?
Quoted 1 line
WARN_ON_ONCE()+ check?
Quoted 1 line
to issue a warning if the if the device control registert
Register? :-)
Quoted 7 lines
Quoted 2 lines
does not exist. And while at it, fix crazy indentation in the
ata_port_warn()call itself...Not clear why you (we?) emphasize this by using "itself"...
Well, if you choose to fix those, I'll be thnakful. But you may as well
ignore me. :-)
Will fix that. Thanks for checking.
Quoted 4 lines
[...]
MBR, Sergey
Signature · 2 lines
Damien Le Moal Western Digital Research