public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RE: Encountered a Null Pointer Problem on the SCSI Layer
@ 2002-01-29 15:03 Peter Wong
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Wong @ 2002-01-29 15:03 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: Pete Zaitcev, linux-kernel, Jens Axboe

Jesper,

     Let's use sd_find_queue() as an example.

     If the array pointed by rscsi_disk has been allocated,
dpnt cannot be null.

     If rscsi_disk has not been allocated, dpnt = &rscsi_disks[target]
may not be null depending on the value of target. Thus, "if (!dpnt)"
is not sufficient anyway.

     You can also look at sd_attach(), in which "if (!dpnt->device)" is
tested, not "if (!dpnt)".

Regards,
Peter

Wai Yee Peter Wong
IBM Linux Technology Center, Performance Analysis
email: wpeter@us.ibm.com



                                                                                                                                       
                      Jesper Juhl                                                                                                      
                      <jju@dif.dk>             To:       "'Pete Zaitcev '" <zaitcev@redhat.com>, Peter Wong/Austin/IBM@IBMUS,          
                                                "'linux-kernel@vger.kernel.org '" <linux-kernel@vger.kernel.org>                       
                      01/28/02 05:57 PM        cc:       "'Jens Axboe '" <axboe@suse.de>                                               
                                               Subject:  RE: Encountered a Null Pointer Problem on the SCSI Layer                      
                                                                                                                                       
                                                                                                                                       
                                                                                                                                       






> -       if (!dpnt)
> +       if (!dpnt->device)
>                 return NULL;    /* No such device */


Maybe I don't understand this right, but shouldn't that be


if (!dpnt || !dpnt->device)
        return NULL;    /* No such device */


?






Best regards,
Jesper Juhl
jju@dif.dk







^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <mailman.1012257244.13523.linux-kernel2news@redhat.com>]
* Encountered a Null Pointer Problem on the SCSI Layer
@ 2002-01-28 22:30 Peter Wong
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Wong @ 2002-01-28 22:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jens Axboe

I encountered a null pointer problem on the SCSI layer when
I was testing Mingming Cao's diskio patch "diskio-stat-rq-2414"
on 2.4.14.

Mingming's patch is at http://sourceforge.net/projects/lse/.

The code in sd_find_queue() that protects against accessing a
non-existent device is not correct. The patch to fix it is given
below. Please check.

The following patch is based on the 2.4.18-pre7 code:

---------------------------------------------------------------------------
--- linux/drivers/scsi/sd.c     Fri Jan 25 14:01:07 2002
+++ linux-2.4.17-diskio/drivers/scsi/sd.c       Fri Jan 25 13:57:01 2002
@@ -279,7 +279,7 @@
        target = DEVICE_NR(dev);

        dpnt = &rscsi_disks[target];
-       if (!dpnt)
+       if (!dpnt->device)
                return NULL;    /* No such device */
        return &dpnt->device->request_queue;
 }
---------------------------------------------------------------------------

Regards,
Peter

Wai Yee Peter Wong
IBM Linux Technology Center, Performance Analysis
email: wpeter@us.ibm.com


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

end of thread, other threads:[~2002-01-30  7:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <8A43C34093B3D5119F7D0004AC56F4BCC3448C@difpst1a.dif.dk>
2002-01-29  0:05 ` Encountered a Null Pointer Problem on the SCSI Layer Pete Zaitcev
2002-01-29 15:03 Peter Wong
     [not found] <mailman.1012257244.13523.linux-kernel2news@redhat.com>
2002-01-28 23:17 ` Pete Zaitcev
2002-01-29  3:51   ` David Ford
2002-01-29 17:22   ` Horst von Brand
  -- strict thread matches above, loose matches on Subject: below --
2002-01-28 22:30 Peter Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox