[PATCH v2 17/22] nvmet: add context annotation for PCI P2P parameters in struct nvmet_ns
Nilay Shroff
nilay at linux.ibm.com
Tue Nov 17 23:34:58 PST 2026
nvmet_ns::p2p_dev and nvmet_ns::use_p2pmem are protected by
nvmet_subsys::lock. Annotate it with __guarded_by(&subsys->lock) so
that the clang context analyzer can validate accesses to this field.
Signed-off-by: Nilay Shroff <nilay at linux.ibm.com>
---
drivers/nvme/target/nvmet.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index db5d5a3fec3d..08cf6364c4a6 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -184,8 +184,10 @@ struct nvmet_ns {
struct completion disable_done;
mempool_t *bvec_pool;
- struct pci_dev *p2p_dev;
- int use_p2pmem;
+ struct pci_dev *p2p_dev
+ __guarded_by(&subsys->lock);
+ int use_p2pmem
+ __guarded_by(&subsys->lock);
int pi_type;
int metadata_size;
u8 csi;
--
2.53.0
More information about the Linux-nvme
mailing list