diff --git a/block/bio-crypt-ctx.c b/block/bio-crypt-ctx.c index 75982dabc7a3..d02d2bff991a 100644 --- a/block/bio-crypt-ctx.c +++ b/block/bio-crypt-ctx.c @@ -96,10 +96,9 @@ bool bio_crypt_ctx_compatible(struct bio *b_1, struct bio *b_2) struct bio_crypt_ctx *bc1 = b_1->bi_crypt_context; struct bio_crypt_ctx *bc2 = b_2->bi_crypt_context; - if (bc1 != bc2) - return false; - - return !bc1 || bc1->bc_key == bc2->bc_key; + if (!bc1) + return !bc2; + return bc2 && bc1->bc_key == bc2->bc_key; } /* diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c index 3f2a7d3be07b..d349b904d95d 100644 --- a/block/blk-crypto-fallback.c +++ b/block/blk-crypto-fallback.c @@ -568,7 +568,7 @@ int blk_crypto_fallback_submit_bio(struct bio **bio_ptr) struct bio_crypt_ctx *bc = bio->bi_crypt_context; struct bio_fallback_crypt_ctx *f_ctx; - if (WARN_ON_ONCE(!tfms_inited[bc->bc_key->crypto_mode])) { + if (!tfms_inited[bc->bc_key->crypto_mode]) { bio->bi_status = BLK_STS_IOERR; return -EIO; } diff --git a/block/blk-crypto-internal.h b/block/blk-crypto-internal.h index 43351eecc97a..40d826b743da 100644 --- a/block/blk-crypto-internal.h +++ b/block/blk-crypto-internal.h @@ -36,7 +36,7 @@ static inline bool bio_crypt_fallback_crypted(const struct bio_crypt_ctx *bc) static inline int blk_crypto_fallback_submit_bio(struct bio **bio_ptr) { - pr_warn_once("blk-crypto crypto API fallback disabled; failing request"); + pr_warn_once("crypto API fallback disabled; failing request\n"); (*bio_ptr)->bi_status = BLK_STS_NOTSUPP; return -EIO; } diff --git a/include/linux/bio-crypt-ctx.h b/include/linux/bio-crypt-ctx.h index 2e06b06fce47..652f92ff75fd 100644 --- a/include/linux/bio-crypt-ctx.h +++ b/include/linux/bio-crypt-ctx.h @@ -118,7 +118,7 @@ static inline bool bio_crypt_dun_is_contiguous(const struct bio_crypt_ctx *bc, int i = 0; unsigned int inc = bytes >> bc->bc_key->data_unit_size_bits; - while (inc && i < BLK_CRYPTO_DUN_ARRAY_SIZE) { + while (i < BLK_CRYPTO_DUN_ARRAY_SIZE) { if (bc->bc_dun[i] + inc != next_dun[i]) return false; inc = ((bc->bc_dun[i] + inc) < inc);