summaryrefslogtreecommitdiff
path: root/crypto/proc.c
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2025-12-19 16:40:24 +0100
committerPeter Zijlstra <peterz@infradead.org>2026-01-05 16:43:36 +0100
commitdc36d55d4e7259ff0f91a154744125ccc2228171 (patch)
tree58b1ff6d120adf795e405027de8ce770233ade9a /crypto/proc.c
parent87335b61a23bd10e4aec132bd3a48a009d406973 (diff)
downloadlinux-next-dc36d55d4e7259ff0f91a154744125ccc2228171.tar.gz
linux-next-dc36d55d4e7259ff0f91a154744125ccc2228171.zip
crypto: Enable context analysis
Enable context analysis for crypto subsystem. This demonstrates a larger conversion to use Clang's context analysis. The benefit is additional static checking of locking rules, along with better documentation. Note the use of the __acquire_ret macro how to define an API where a function returns a pointer to an object (struct scomp_scratch) with a lock held. Additionally, the analysis only resolves aliases where the analysis unambiguously sees that a variable was not reassigned after initialization, requiring minor code changes. Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20251219154418.3592607-36-elver@google.com
Diffstat (limited to 'crypto/proc.c')
-rw-r--r--crypto/proc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/proc.c b/crypto/proc.c
index 82f15b967e85..5fb9fe86d023 100644
--- a/crypto/proc.c
+++ b/crypto/proc.c
@@ -19,17 +19,20 @@
#include "internal.h"
static void *c_start(struct seq_file *m, loff_t *pos)
+ __acquires_shared(&crypto_alg_sem)
{
down_read(&crypto_alg_sem);
return seq_list_start(&crypto_alg_list, *pos);
}
static void *c_next(struct seq_file *m, void *p, loff_t *pos)
+ __must_hold_shared(&crypto_alg_sem)
{
return seq_list_next(p, &crypto_alg_list, pos);
}
static void c_stop(struct seq_file *m, void *p)
+ __releases_shared(&crypto_alg_sem)
{
up_read(&crypto_alg_sem);
}