Skip to content

Commit 0daaa61

Browse files
gnoackl0kod
authored andcommitted
landlock: Optimize the number of calls to get_access_mask slightly
This call is now going through a function pointer, and it is not as obvious any more that it will be inlined. Signed-off-by: Günther Noack <gnoack@google.com> Link: https://lore.kernel.org/r/20231208155121.1943775-4-gnoack@google.com Fixes: 7a11275 ("landlock: Refactor layer helpers") Signed-off-by: Mickaël Salaün <mic@digikod.net>
1 parent b838dd7 commit 0daaa61

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

security/landlock/ruleset.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,11 +723,12 @@ landlock_init_layer_masks(const struct landlock_ruleset *const domain,
723723
/* Saves all handled accesses per layer. */
724724
for (layer_level = 0; layer_level < domain->num_layers; layer_level++) {
725725
const unsigned long access_req = access_request;
726+
const access_mask_t access_mask =
727+
get_access_mask(domain, layer_level);
726728
unsigned long access_bit;
727729

728730
for_each_set_bit(access_bit, &access_req, num_access) {
729-
if (BIT_ULL(access_bit) &
730-
get_access_mask(domain, layer_level)) {
731+
if (BIT_ULL(access_bit) & access_mask) {
731732
(*layer_masks)[access_bit] |=
732733
BIT_ULL(layer_level);
733734
handled_accesses |= BIT_ULL(access_bit);

0 commit comments

Comments
 (0)