public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] blk-integrity: checking for NULL instead of IS_ERR
@ 2015-12-09 10:21 Dan Carpenter
  2015-12-09 10:26 ` Johannes Thumshirn
  2015-12-09 15:04 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-12-09 10:21 UTC (permalink / raw)
  To: Jens Axboe, Keith Busch; +Cc: linux-block, linux-kernel, kernel-janitors

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')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index e6ba501..711e4d8d 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -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));

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] blk-integrity: checking for NULL instead of IS_ERR
  2015-12-09 10:21 [patch] blk-integrity: checking for NULL instead of IS_ERR Dan Carpenter
@ 2015-12-09 10:26 ` Johannes Thumshirn
  2015-12-09 15:04 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2015-12-09 10:26 UTC (permalink / raw)
  To: Dan Carpenter, Jens Axboe, Keith Busch
  Cc: linux-block, linux-kernel, kernel-janitors

On Wed, 2015-12-09 at 13:21 +0300, Dan Carpenter wrote:
> 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')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/block/bio-integrity.c b/block/bio-integrity.c
> index e6ba501..711e4d8d 100644
> --- a/block/bio-integrity.c
> +++ b/block/bio-integrity.c
> @@ -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));
> --
> To unsubscribe from this list: send the line "unsubscribe linux-block" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] blk-integrity: checking for NULL instead of IS_ERR
  2015-12-09 10:21 [patch] blk-integrity: checking for NULL instead of IS_ERR Dan Carpenter
  2015-12-09 10:26 ` Johannes Thumshirn
@ 2015-12-09 15:04 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2015-12-09 15:04 UTC (permalink / raw)
  To: Dan Carpenter, Keith Busch; +Cc: linux-block, linux-kernel, kernel-janitors

On 12/09/2015 03:21 AM, Dan Carpenter wrote:
> 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')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-09 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-09 10:21 [patch] blk-integrity: checking for NULL instead of IS_ERR Dan Carpenter
2015-12-09 10:26 ` Johannes Thumshirn
2015-12-09 15:04 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox