[PATCH] ata: libata-sff: fix reading uninitialized variable in ata_sff_lost_interrupt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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...

Fixes: 2c75a451ecb0 ("ata: libata-sff: refactor ata_sff_altstatus()")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Sergey Shtylyov <s.shtylyov@xxxxxx>

---
 drivers/ata/libata-sff.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: libata/drivers/ata/libata-sff.c
===================================================================
--- libata.orig/drivers/ata/libata-sff.c
+++ libata/drivers/ata/libata-sff.c
@@ -1644,13 +1644,14 @@ void ata_sff_lost_interrupt(struct ata_p
 		return;
 	/* 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);



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux