linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* libata-scsi.c: new check-after-use
@ 2008-01-14 21:08 Adrian Bunk
  2008-01-14 23:46 ` [PATCH #upstream-fixes] libata: relocate sdev->manage_start_stop configuration Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2008-01-14 21:08 UTC (permalink / raw)
  To: Ondrej Zary, Tejun Heo, Jeff Garzik; +Cc: linux-ide, linux-kernel


Commit 9b8e8de7e59b3a2dab3113d620b52dc8ba890fb3 did:

--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -872,7 +872,8 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
 
 	ata_scsi_sdev_config(sdev);
 
-	sdev->manage_start_stop = 1;
+	if (dev->class == ATA_DEV_ATA)
+		sdev->manage_start_stop = 1;
 
 	if (dev)
 		ata_scsi_dev_config(sdev, dev);


The Coverity checker spotted that this introduced a check-after-use
for "dev".


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] 2+ messages in thread

* [PATCH #upstream-fixes] libata: relocate sdev->manage_start_stop configuration
  2008-01-14 21:08 libata-scsi.c: new check-after-use Adrian Bunk
@ 2008-01-14 23:46 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2008-01-14 23:46 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Ondrej Zary, Jeff Garzik, linux-ide, linux-kernel

After 9b8e8de7, manage_start_stop configuration depends on valid ATA
device.  Move it into ata_scsi_dev_config().  This was detected by the
coverity checker.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Adrian Bunk <bunk@kernel.org>
---
 drivers/ata/libata-scsi.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 7c13663..a6575b7 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -841,6 +841,9 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
 		blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
 	}
 
+	if (dev->class == ATA_DEV_ATA)
+		sdev->manage_start_stop = 1;
+
 	if (dev->flags & ATA_DFLAG_AN)
 		set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
 
@@ -872,9 +875,6 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
 
 	ata_scsi_sdev_config(sdev);
 
-	if (dev->class == ATA_DEV_ATA)
-		sdev->manage_start_stop = 1;
-
 	if (dev)
 		ata_scsi_dev_config(sdev, dev);
 

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

end of thread, other threads:[~2008-01-14 23:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-14 21:08 libata-scsi.c: new check-after-use Adrian Bunk
2008-01-14 23:46 ` [PATCH #upstream-fixes] libata: relocate sdev->manage_start_stop configuration Tejun Heo

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