summaryrefslogtreecommitdiff
path: root/src/test/test-bpf-firewall.c
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2021-01-10 15:36:31 +0000
committerLuca Boccassi <bluca@debian.org>2021-01-10 21:16:38 +0000
commit9ca600e2bfacc52a65c89f3485723b2c27394e55 (patch)
treed0f46c4d509aa0dd832887f6a07395d8894a9821 /src/test/test-bpf-firewall.c
parent90f989861e1f7fd4465a8dddd1721b54ecb3f273 (diff)
downloadsystemd-9ca600e2bfacc52a65c89f3485723b2c27394e55.tar.gz
bpf: do not use structured initialization for bpf_attr
It looks like zero'ing the struct is not enough, and with some level of optimizations there is still non-zero padding left over. Switch to member-by-member initialization. Also convert all remaining bpf_attr variables in other files.
Diffstat (limited to 'src/test/test-bpf-firewall.c')
-rw-r--r--src/test/test-bpf-firewall.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/test-bpf-firewall.c b/src/test/test-bpf-firewall.c
index cb7d8398a8..b6fd22904f 100644
--- a/src/test/test-bpf-firewall.c
+++ b/src/test/test-bpf-firewall.c
@@ -8,6 +8,7 @@
#include "bpf-program.h"
#include "load-fragment.h"
#include "manager.h"
+#include "memory-util.h"
#include "rm-rf.h"
#include "service.h"
#include "tests.h"
@@ -77,11 +78,10 @@ int main(int argc, char *argv[]) {
assert(r >= 0);
if (test_custom_filter) {
- attr = (union bpf_attr) {
- .pathname = PTR_TO_UINT64(test_prog),
- .bpf_fd = p->kernel_fd,
- .file_flags = 0,
- };
+ zero(attr);
+ attr.pathname = PTR_TO_UINT64(test_prog);
+ attr.bpf_fd = p->kernel_fd;
+ attr.file_flags = 0;
(void) unlink(test_prog);