Skip to content

Commit

Permalink
bpf,test: Fix missing __align_stack_8 to bpf_nat_tests.c
Browse files Browse the repository at this point in the history
Coccicheck pointed out following

* file ./tests/bpf_nat_tests.c: missing __align_stack_8 on icmphdr on line 56
* file ./tests/bpf_nat_tests.c: missing __align_stack_8 on inner_l4 on line 114
* file ./tests/bpf_nat_tests.c: missing __align_stack_8 on in_l4hdr on line 431

Fix them by adding missing __align_stack_8.

Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
  • Loading branch information
YutaroHayakawa committed Mar 23, 2023
1 parent 053a172 commit f47ab90
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bpf/tests/bpf_nat_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ __always_inline int mk_icmp4_error_pkt(void *dst, __u8 error_hdr)
memcpy(dst, &l3, sizeof(struct iphdr));
dst += sizeof(struct iphdr);

struct icmphdr icmphdr = {
struct icmphdr icmphdr __align_stack_8 = {
.type = ICMP_DEST_UNREACH,
.code = ICMP_FRAG_NEEDED,
.un = {
Expand Down Expand Up @@ -111,7 +111,7 @@ __always_inline int mk_icmp4_error_pkt(void *dst, __u8 error_hdr)
}
break;
case IPPROTO_ICMP: {
struct icmphdr inner_l4 = {
struct icmphdr inner_l4 __align_stack_8 = {
.type = ICMP_ECHO,
.un = {
.echo = {
Expand Down Expand Up @@ -428,7 +428,7 @@ int test_nat4_icmp_error_icmp(__maybe_unused struct __ctx_buff *ctx)
int in_l3_off;
int in_l4_off;
struct iphdr in_ip4;
struct icmphdr in_l4hdr;
struct icmphdr in_l4hdr __align_stack_8;

in_l3_off = l4_off + sizeof(icmphdr);
if (ctx_load_bytes(ctx, in_l3_off, &in_ip4,
Expand Down

0 comments on commit f47ab90

Please sign in to comment.