Skip to content

Commit

Permalink
[SCSI] libosd: fix potential ERR_PTR dereference in osd_initiator.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and James Bottomley committed Apr 27, 2009
1 parent 3b8b5c9 commit bf5e84f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/scsi/osd/osd_initiator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bf5e84f

Please sign in to comment.