summaryrefslogtreecommitdiff
path: root/drivers/nvme/host
diff options
context:
space:
mode:
authorAnuj Gupta <anuj20.g@samsung.com>2025-06-30 14:35:46 +0530
committerChristian Brauner <brauner@kernel.org>2025-07-01 14:00:15 +0200
commit76e45252a4cefa205439eb6610a244771e7d88da (patch)
tree939648040edf317190ebf7fb581104f94b2aa618 /drivers/nvme/host
parentc6603b1d6556cc02d0169f74508ab0e3e3e4bd76 (diff)
downloadlinux-next-76e45252a4cefa205439eb6610a244771e7d88da.tar.gz
linux-next-76e45252a4cefa205439eb6610a244771e7d88da.zip
block: introduce pi_tuple_size field in blk_integrity
Introduce a new pi_tuple_size field in struct blk_integrity to explicitly represent the size (in bytes) of the protection information (PI) tuple. This is a prep patch. Add validation in blk_validate_integrity_limits() to ensure that pi size matches the expected size for known checksum types and never exceeds the pi_tuple_size. Suggested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Link: https://lore.kernel.org/20250630090548.3317-3-anuj20.g@samsung.com Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'drivers/nvme/host')
-rw-r--r--drivers/nvme/host/core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b027dda38e69..fe72accab516 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1867,6 +1867,8 @@ static bool nvme_init_integrity(struct nvme_ns_head *head,
}
bi->metadata_size = head->ms;
+ if (bi->csum_type)
+ bi->pi_tuple_size = head->pi_size;
bi->pi_offset = info->pi_offset;
return true;
}