bpf: skmsg, replace comments with BUILD bug
Enforce comment on structure layout dependency with a BUILD_BUG_ON to ensure the condition is maintained. Suggested-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:

committed by
Daniel Borkmann

parent
bc1b4f013b
commit
7a69c0f250
@@ -7425,6 +7425,9 @@ static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
|
||||
int off;
|
||||
#endif
|
||||
|
||||
/* convert ctx uses the fact sg element is first in struct */
|
||||
BUILD_BUG_ON(offsetof(struct sk_msg, sg) != 0);
|
||||
|
||||
switch (si->off) {
|
||||
case offsetof(struct sk_msg_md, data):
|
||||
*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct sk_msg, data),
|
||||
|
Reference in New Issue
Block a user