Skip to content

eBPF-based security platform

bpf: follow the kernel coding style in the LSM programs

Daniel Borkmann8c42cf3ba7a5
diff --git a/bpf/bpf2.c b/bpf/bpf2.c
index 7757d778..2e9405d7 100644
--- a/bpf/bpf2.c
+++ b/bpf/bpf2.c
@@ -222,9 +222,10 @@ int BPF_PROG(shirudo_lsm_key_permission, key_ref_t key_ref,
key = (struct key *)((unsigned long)key_ref & ~1UL);
serial = BPF_CORE_READ(key, serial);
if (serial != id->keyring_serial) {
- for (i = 0; i < SHIRUDO_IDENTITY_KEYS_MAX; i++)
+ for (i = 0; i < SHIRUDO_IDENTITY_KEYS_MAX; i++) {
if (i < id->n_keys && id->key_serials[i] == serial)
break;
+ }
if (i == SHIRUDO_IDENTITY_KEYS_MAX)
return 0; /* not the anchor -- not ours */
}
diff --git a/bpf/seal.c b/bpf/seal.c
index af4191d4..58c32602 100644
--- a/bpf/seal.c
+++ b/bpf/seal.c
@@ -123,8 +123,8 @@ static __always_inline bool seal_is_label(const char *name)
return !bpf_strncmp(buf, sizeof(SHIRUDO_XATTR), SHIRUDO_XATTR);
}
-static __always_inline struct seal_scratch *seal_scratch_get(
- struct task_struct *task)
+static __always_inline struct seal_scratch *
+seal_scratch_get(struct task_struct *task)
{
return bpf_task_storage_get(&seal_scratch_map, task, NULL,
BPF_LOCAL_STORAGE_GET_F_CREATE);