linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/scsi/ahci.c:ahci_interrupt(): NULL pointer dereference
@ 2006-03-10 19:34 Adrian Bunk
  2006-03-11  3:47 ` [PATCH] ahci: fix NULL pointer dereference detected by Coverity Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Bunk @ 2006-03-10 19:34 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-ide, linux-kernel

The Coverity checker spotted this bug (note the ap dereference)

<--  snip  -->

...
                if (ap) {
...
                } else {
                        VPRINTK("port %u (no irq)\n", i);
                        if (ata_ratelimit()) {
                                struct pci_dev *pdev =
                                        to_pci_dev(ap->host_set->dev);
...

<--  snip  -->


cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] ahci: fix NULL pointer dereference detected by Coverity
  2006-03-10 19:34 drivers/scsi/ahci.c:ahci_interrupt(): NULL pointer dereference Adrian Bunk
@ 2006-03-11  3:47 ` Tejun Heo
  2006-03-12  0:10   ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2006-03-11  3:47 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: jgarzik, linux-ide, linux-kernel

Fix NULL pointer dereference detected by the Coverity checker.  Kill
dev -> pdev -> dev conversion while at it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Adrian Bunk <bunk@stusta.de>

--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -778,23 +778,17 @@ static irqreturn_t ahci_interrupt (int i
 			struct ata_queued_cmd *qc;
 			qc = ata_qc_from_tag(ap, ap->active_tag);
 			if (!ahci_host_intr(ap, qc))
-				if (ata_ratelimit()) {
-					struct pci_dev *pdev =
-						to_pci_dev(ap->host_set->dev);
-					dev_printk(KERN_WARNING, &pdev->dev,
+				if (ata_ratelimit())
+					dev_printk(KERN_WARNING, host_set->dev,
 					  "unhandled interrupt on port %u\n",
 					  i);
-				}
 
 			VPRINTK("port %u\n", i);
 		} else {
 			VPRINTK("port %u (no irq)\n", i);
-			if (ata_ratelimit()) {
-				struct pci_dev *pdev =
-					to_pci_dev(ap->host_set->dev);
-				dev_printk(KERN_WARNING, &pdev->dev,
+			if (ata_ratelimit())
+				dev_printk(KERN_WARNING, host_set->dev,
 					"interrupt on disabled port %u\n", i);
-			}
 		}
 
 		irq_ack |= (1 << i);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ahci: fix NULL pointer dereference detected by Coverity
  2006-03-11  3:47 ` [PATCH] ahci: fix NULL pointer dereference detected by Coverity Tejun Heo
@ 2006-03-12  0:10   ` Jeff Garzik
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2006-03-12  0:10 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Adrian Bunk, linux-ide, linux-kernel

Tejun Heo wrote:
> Fix NULL pointer dereference detected by the Coverity checker.  Kill
> dev -> pdev -> dev conversion while at it.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> Cc: Adrian Bunk <bunk@stusta.de>

applied to #upstream-fixes



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-12  0:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-10 19:34 drivers/scsi/ahci.c:ahci_interrupt(): NULL pointer dereference Adrian Bunk
2006-03-11  3:47 ` [PATCH] ahci: fix NULL pointer dereference detected by Coverity Tejun Heo
2006-03-12  0:10   ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).