[SCSI] libosd: fix potential ERR_PTR dereference in osd_initiator.c
authorDan Carpenter <error27@gmail.com>
Sun, 19 Apr 2009 16:07:47 +0000 (19:07 +0300)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 27 Apr 2009 16:05:31 +0000 (11:05 -0500)
bio_map_kern() returns an ERR_PTR() not NULL.

Found by smatch (http://repo.or.cz/w/smatch.git).  Compile tested.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/osd/osd_initiator.c

index 2a5f077..76de889 100644 (file)
@@ -612,9 +612,9 @@ static int _osd_req_list_objects(struct osd_request *or,
 
        WARN_ON(or->in.bio);
        bio = bio_map_kern(q, list, len, or->alloc_flags);
-       if (!bio) {
+       if (IS_ERR(bio)) {
                OSD_ERR("!!! Failed to allocate list_objects BIO\n");
-               return -ENOMEM;
+               return PTR_ERR(bio);
        }
 
        bio->bi_rw &= ~(1 << BIO_RW);