Skip to contentSkip to conversation

blk-integrity: checking for NULL instead of IS_ERR

PATCH Applied Dan Carpenter 3 participants 3 messages Dec 9, 2015

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

PATCH 1/1 blk-integrity: checking for NULL instead of IS_ERR

We recently changed bio_integrity_alloc() to return ERR_PTRs instead of NULL but these calls were missed.

Fixes 06c1e3902aa7 ('blk-integrity: empty implementation when disabled')
block/bio-integrity.c +4 -5
index e6ba501..711e4d8d 100644
@@ -298,10 +298,10 @@ int bio_integrity_prep(struct bio *bio)
 
 	/* Allocate bio integrity payload and integrity vectors */
 	bip = bio_integrity_alloc(bio, GFP_NOIO, nr_pages);
-	if (unlikely(bip = NULL)) {
+	if (IS_ERR(bip)) {
 		printk(KERN_ERR "could not allocate data integrity bioset\n");
 		kfree(buf);
-		return -EIO;
+		return PTR_ERR(bip);
 	}
 
 	bip->bip_flags |= BIP_BLOCK_INTEGRITY;
@@ -465,9 +465,8 @@ int bio_integrity_clone(struct bio *bio, struct bio *bio_src,
 	BUG_ON(bip_src = NULL);
 
 	bip = bio_integrity_alloc(bio, gfp_mask, bip_src->bip_vcnt);
-
-	if (bip = NULL)
-		return -EIO;
+	if (IS_ERR(bip))
+		return PTR_ERR(bip);
 
 	memcpy(bip->bip_vec, bip_src->bip_vec,
 	       bip_src->bip_vcnt * sizeof(struct bio_vec));
Reviewed-by on v1 1/1
#1 lore raw
Quoted 34 lines · Dan Carpenter

We recently changed bio_integrity_alloc() to return ERR_PTRs instead of NULL but these calls were missed.

Fixes 06c1e3902aa7 ('blk-integrity: empty implementation when disabled')
block/bio-integrity.c +0 -0
index e6ba501..711e4d8d 100644
@@ -298,10 +298,10 @@ int bio_integrity_prep(struct bio *bio)


  /* Allocate bio integrity payload and integrity vectors */ bip = bio_integrity_alloc(bio, GFP_NOIO, nr_pages);

block/bio-integrity.c +1 -1
-	if (unlikely(bip = NULL)) {
+	if (IS_ERR(bip)) {

  printk(KERN_ERR "could not allocate data integrity bioset\n");
  kfree(buf);

block/bio-integrity.c +1 -1
-		return -EIO;
+		return PTR_ERR(bip);

  }

  bip->bip_flags |= BIP_BLOCK_INTEGRITY;

block/bio-integrity.c +0 -0
@@ -465,9 +465,8 @@ int bio_integrity_clone(struct bio *bio, struct bio
 *bio_src,
  	BUG_ON(bip_src = NULL);


  bip = bio_integrity_alloc(bio, gfp_mask, bip_src->bip_vcnt);

block/bio-integrity.c +2 -3
-
-	if (bip = NULL)
-		return -EIO;
+	if (IS_ERR(bip))
+		return PTR_ERR(bip);
Quoted 7 lines


  memcpy(bip->bip_vec, bip_src->bip_vec, bip_src->bip_vcnt * sizeof(struct bio_vec)); --
To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

We recently changed bio_integrity_alloc() to return ERR_PTRs instead of NULL but these calls were missed.

Fixes 06c1e3902aa7 ('blk-integrity: empty implementation when disabled')

Thanks, applied.

Signature · 1 line
Jens Axboe