Re: [PATCH] ide: no need to check for the rq pointer to be NULL

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

 



Ooops, you're right, ide_kill_rq() sets  hwif->rq (and rq in turn) to NULL.
Please disregard this patch.

Vasily

On Mon, Jan 10, 2011 at 03:25:47PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 10-01-2011 2:51, Vasily Tarasov wrote:
> 
> >From: Vasily Tarasov<sectorsize512@xxxxxxxxx>
> 
> >No need to check for the rq pointer to be NULL before calling
> >blk_fetch_request().  First we call it, then we test the pointer that it
> >returns.
> 
> >Signed-off-by: Vasily Tarasov<sectorsize512@xxxxxxxxx>
> 
>    I'm not feeling sure about this patch...
> 
> >--- linux-2.6.37/drivers/ide/ide-io.c.orig	2011-01-04 19:50:19.000000000 -0500
> >+++ linux-2.6.37/drivers/ide/ide-io.c	2011-01-09 18:15:44.000000000 -0500
> >@@ -438,7 +438,7 @@ void do_ide_request(struct request_queue
> >  	ide_drive_t	*drive = q->queuedata;
> >  	ide_hwif_t	*hwif = drive->hwif;
> >  	struct ide_host *host = hwif->host;
> >-	struct request	*rq = NULL;
> >+	struct request	*rq;
> >  	ide_startstop_t	startstop;
> >
> >  	spin_unlock_irq(q->queue_lock);
> >@@ -485,16 +485,13 @@ repeat:
> >
> >  		spin_unlock_irq(&hwif->lock);
> >  		spin_lock_irq(q->queue_lock);
> >+		rq = blk_fetch_request(drive->queue);
> >+		spin_unlock_irq(q->queue_lock);
> >+		spin_lock_irq(&hwif->lock);
> >  		/*
> >  		 * we know that the queue isn't empty, but this can happen
> >  		 * if the q->prep_rq_fn() decides to kill a request
> >  		 */
> >-		if (!rq)
> >-			rq = blk_fetch_request(drive->queue);
> 
>    Did you consider the scenario where the 'goto' is taken at the
> end of this *if* branch? 'rq' is non-NULL then...
> 
> >-
> >-		spin_unlock_irq(q->queue_lock);
> >-		spin_lock_irq(&hwif->lock);
> >-
> >  		if (!rq) {
> >  			ide_unlock_port(hwif);
> >  			goto out;
> 
> WBR, Serge
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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