Skip to content

Commit c546d6f

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: only zero non-PI metadata tuples in bio_integrity_prep
The PI generation helpers already zero the app tag, so relax the zeroing to non-PI metadata. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Kanchan Joshi <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent f1e4675 commit c546d6f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

block/bio-integrity.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,11 @@ bool bio_integrity_prep(struct bio *bio)
456456

457457
/*
458458
* Zero the memory allocated to not leak uninitialized kernel
459-
* memory to disk. For PI this only affects the app tag, but
460-
* for non-integrity metadata it affects the entire metadata
461-
* buffer.
459+
* memory to disk for non-integrity metadata where nothing else
460+
* initializes the memory.
462461
*/
463-
gfp |= __GFP_ZERO;
462+
if (bi->csum_type == BLK_INTEGRITY_CSUM_NONE)
463+
gfp |= __GFP_ZERO;
464464
}
465465

466466
/* Allocate kernel buffer for protection data */

0 commit comments

Comments
 (0)