Skip to content

Commit 7e87965

Browse files
sagigrimbergChristoph Hellwig
authored andcommitted
nvme-tcp: add nvme-tcp pdu size build protection
Make sure that we don't somehow mess up the wire structures in the spec. Signed-off-by: Sagi Grimberg <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent a340635 commit 7e87965

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/nvme/host/tcp.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2694,6 +2694,15 @@ static struct nvmf_transport_ops nvme_tcp_transport = {
26942694

26952695
static int __init nvme_tcp_init_module(void)
26962696
{
2697+
BUILD_BUG_ON(sizeof(struct nvme_tcp_hdr) != 8);
2698+
BUILD_BUG_ON(sizeof(struct nvme_tcp_cmd_pdu) != 72);
2699+
BUILD_BUG_ON(sizeof(struct nvme_tcp_data_pdu) != 24);
2700+
BUILD_BUG_ON(sizeof(struct nvme_tcp_rsp_pdu) != 24);
2701+
BUILD_BUG_ON(sizeof(struct nvme_tcp_r2t_pdu) != 24);
2702+
BUILD_BUG_ON(sizeof(struct nvme_tcp_icreq_pdu) != 128);
2703+
BUILD_BUG_ON(sizeof(struct nvme_tcp_icresp_pdu) != 128);
2704+
BUILD_BUG_ON(sizeof(struct nvme_tcp_term_pdu) != 24);
2705+
26972706
nvme_tcp_wq = alloc_workqueue("nvme_tcp_wq",
26982707
WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
26992708
if (!nvme_tcp_wq)

0 commit comments

Comments
 (0)