block: Trivial fix for blk_integrity_rq()
authorMartin K. Petersen <martin.petersen@oracle.com>
Wed, 16 Jul 2008 20:09:06 +0000 (16:09 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 16 Jul 2008 21:51:41 +0000 (14:51 -0700)
Fail integrity check gracefully when request does not have a bio
attached (BLOCK_PC).

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/blkdev.h

index 32a441b..88d6808 100644 (file)
@@ -985,6 +985,9 @@ static inline int bdev_integrity_enabled(struct block_device *bdev, int rw)
 
 static inline int blk_integrity_rq(struct request *rq)
 {
+       if (rq->bio == NULL)
+               return 0;
+
        return bio_integrity(rq->bio);
 }