Skip to content

Commit

Permalink
blk-integrity: checking for NULL instead of IS_ERR
Browse files Browse the repository at this point in the history
We recently changed bio_integrity_alloc() to return ERR_PTRs instead of
NULL but these calls were missed.

Fixes: 06c1e39 ('blk-integrity: empty implementation when disabled')
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Dan Carpenter authored and axboe committed Dec 9, 2015
1 parent d1ea7be commit 7b6c0f8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions block/bio-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 7b6c0f8

Please sign in to comment.