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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/