Skip to contentSkip to conversation

scsi/osd: checking NULL instead of ERR_PTR()

PATCH In review Dan Carpenter 2 participants 4 messages Nov 12, 2010 – Nov 30, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi/osd: checking NULL instead of ERR_PTR()

bio_map_kern() returns ERR_PTRs on failure and never returns NULL.

drivers/scsi/osd/osd_initiator.c +2 -2
index 0433ea6..b798919 100644
@@ -951,8 +951,8 @@ static int _osd_req_finalize_cdb_cont(struct osd_request *or, const u8 *cap_key)
 	/* create a bio for continuation segment */
 	bio = bio_map_kern(req_q, or->cdb_cont.buff, or->cdb_cont.total_bytes,
 			   GFP_KERNEL);
-	if (unlikely(!bio))
-		return -ENOMEM;
+	if (unlikely(IS_ERR(bio)))
+		return PTR_ERR(bio);
 
 	bio->bi_rw |= REQ_WRITE;
 
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Dan Carpenter

bio_map_kern() returns ERR_PTRs on failure and never returns NULL.

Quoted 5 lines
drivers/scsi/osd/osd_initiator.c +0 -0
index 0433ea6..b798919 100644

drivers/scsi/osd/osd_initiator.c static int _osd_req_finalize_cdb_cont(struct osd_request *or, const u8 *cap_key) · line 958

Quoted 10 lines
drivers/scsi/osd/osd_initiator.c +2 -2
@@ -951,8 +951,8 @@ static int _osd_req_finalize_cdb_cont(struct osd_request *or, const u8 *cap_key)
 	/* create a bio for continuation segment */
 	bio = bio_map_kern(req_q, or->cdb_cont.buff, or->cdb_cont.total_bytes,
 			   GFP_KERNEL);
-	if (unlikely(!bio))
-		return -ENOMEM;
+	if (unlikely(IS_ERR(bio)))
+		return PTR_ERR(bio);
 
 	bio->bi_rw |= REQ_WRITE;
 

Wahoo, good catch, thanks! This is new code in 2.6.37-rc1. It should be pushed for current Kernel.

James: please apply to scsi-rc-fixes for the next round of fixes?

Thanks
Boaz

#2 lore raw
Quoted 8 lines · Boaz Harrosh
Quoted 4 lines · Dan Carpenter

bio_map_kern() returns ERR_PTRs on failure and never returns NULL.

James! Please submit this patch for scsi-rc-fixes. It is an important fix for code that went into this merge window.

Thanks
Boaz

Quoted 23 lines
Quoted 5 lines
drivers/scsi/osd/osd_initiator.c +0 -0
index 0433ea6..b798919 100644

drivers/scsi/osd/osd_initiator.c static int _osd_req_finalize_cdb_cont(struct osd_request *or, const u8 *cap_key) · line 958

Quoted 10 lines
drivers/scsi/osd/osd_initiator.c +2 -2
@@ -951,8 +951,8 @@ static int _osd_req_finalize_cdb_cont(struct osd_request *or, const u8 *cap_key)
 	/* create a bio for continuation segment */
 	bio = bio_map_kern(req_q, or->cdb_cont.buff, or->cdb_cont.total_bytes,
 			   GFP_KERNEL);
-	if (unlikely(!bio))
-		return -ENOMEM;
+	if (unlikely(IS_ERR(bio)))
+		return PTR_ERR(bio);
 
 	bio->bi_rw |= REQ_WRITE;
 

Wahoo, good catch, thanks! This is new code in 2.6.37-rc1. It should be pushed for current Kernel.

James: please apply to scsi-rc-fixes for the next round of fixes?

Thanks
Boaz

#3 lore raw
Quoted 7 lines · Boaz Harrosh
Quoted 6 lines · Boaz Harrosh
Quoted 4 lines · Dan Carpenter

bio_map_kern() returns ERR_PTRs on failure and never returns NULL.

Quoted 9 lines
Quoted 2 lines

James! Please submit this patch for scsi-rc-fixes. It is an important fix for code that went into this merge window.

Thanks
Boaz

James, ping?

Quoted 28 lines
Quoted 19 lines
Quoted 5 lines
drivers/scsi/osd/osd_initiator.c +0 -0
index 0433ea6..b798919 100644

drivers/scsi/osd/osd_initiator.c static int _osd_req_finalize_cdb_cont(struct osd_request *or, const u8 *cap_key) · line 958

Quoted 10 lines
drivers/scsi/osd/osd_initiator.c +2 -2
@@ -951,8 +951,8 @@ static int _osd_req_finalize_cdb_cont(struct osd_request *or, const u8 *cap_key)
 	/* create a bio for continuation segment */
 	bio = bio_map_kern(req_q, or->cdb_cont.buff, or->cdb_cont.total_bytes,
 			   GFP_KERNEL);
-	if (unlikely(!bio))
-		return -ENOMEM;
+	if (unlikely(IS_ERR(bio)))
+		return PTR_ERR(bio);
 
 	bio->bi_rw |= REQ_WRITE;
 

Wahoo, good catch, thanks! This is new code in 2.6.37-rc1. It should be pushed for current Kernel.

Quoted 4 lines

James: please apply to scsi-rc-fixes for the next round of fixes?

Thanks
Boaz

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html