diff options
| author | Tingmao Wang <m@maowtm.org> | 2026-06-12 04:48:51 +0300 |
|---|---|---|
| committer | Mickaël Salaün <mic@digikod.net> | 2026-06-14 21:17:22 +0300 |
| commit | 73c2f82b3253bb5448d7e26170feaa03189c436a (patch) | |
| tree | 1a00ebe0381eab757651e458a1d61bf64d4fea1b | |
| parent | 8faab14922b75c3c0bbc0769eedef85d4609a85a (diff) | |
| download | linux-73c2f82b3253bb5448d7e26170feaa03189c436a.tar.xz | |
selftests/landlock: Replace hard-coded 16 with a constant
The next commit will reuse this number. Make it a shared constant to
future-proof changes.
Signed-off-by: Tingmao Wang <m@maowtm.org>
Link: https://patch.msgid.link/eff35caa9b4ac51aa83a88d67c4dd67f4f8b3a4a.1781228815.git.m@maowtm.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
| -rw-r--r-- | tools/testing/selftests/landlock/audit_test.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/landlock/common.h | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/landlock/fs_test.c | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/selftests/landlock/audit_test.c b/tools/testing/selftests/landlock/audit_test.c index bd9f207b36e4..161ab5feb2b9 100644 --- a/tools/testing/selftests/landlock/audit_test.c +++ b/tools/testing/selftests/landlock/audit_test.c @@ -76,7 +76,7 @@ TEST_F(audit, layers) .scoped = LANDLOCK_SCOPE_SIGNAL, }; int status, ruleset_fd, i; - __u64(*domain_stack)[16]; + __u64(*domain_stack)[LANDLOCK_MAX_NUM_LAYERS]; __u64 prev_dom = 3; pid_t child; diff --git a/tools/testing/selftests/landlock/common.h b/tools/testing/selftests/landlock/common.h index 90551650299c..7206d5105d66 100644 --- a/tools/testing/selftests/landlock/common.h +++ b/tools/testing/selftests/landlock/common.h @@ -25,6 +25,8 @@ /* TEST_F_FORK() should not be used for new tests. */ #define TEST_F_FORK(fixture_name, test_name) TEST_F(fixture_name, test_name) +#define LANDLOCK_MAX_NUM_LAYERS 16 + static const char bin_sandbox_and_launch[] = "./sandbox-and-launch"; static const char bin_wait_pipe[] = "./wait-pipe"; static const char bin_wait_pipe_sandbox[] = "./wait-pipe-sandbox"; diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c index cdb47fc1fc0a..10d9355ade5f 100644 --- a/tools/testing/selftests/landlock/fs_test.c +++ b/tools/testing/selftests/landlock/fs_test.c @@ -1441,7 +1441,7 @@ TEST_F_FORK(layout0, max_layers) }; const int ruleset_fd = create_ruleset(_metadata, ACCESS_RW, rules); - for (i = 0; i < 16; i++) + for (i = 0; i < LANDLOCK_MAX_NUM_LAYERS; i++) enforce_ruleset(_metadata, ruleset_fd); for (i = 0; i < 2; i++) { |
