Skip to contentSkip to conversation

keys/trusted_keys: mark 'migratable' as __ro_after_init

PATCH In review Len Bao 2 participants 2 messages May 16 – May 19

Subsystems (3)
lore
Share & tools
lore

Len Bao

author
#0 lore raw

PATCH 1/1 keys/trusted_keys: mark 'migratable' as __ro_after_init

The 'migratable' variable is initialized only during the init phase in the 'init_trusted' function and never changed. So, mark it as __ro_after_init.

---
 security/keys/trusted-keys/trusted_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/trusted-keys/trusted_core.c +1 -1
index 0b142d941..433579365 100644
@@ -59,7 +59,7 @@ DEFINE_STATIC_CALL_NULL(trusted_key_unseal,
 DEFINE_STATIC_CALL_NULL(trusted_key_get_random,
 			*trusted_key_sources[0].ops->get_random);
 static void (*trusted_key_exit)(void);
-static unsigned char migratable;
+static unsigned char migratable __ro_after_init;
 
 enum {
 	Opt_err,
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Len Bao

The 'migratable' variable is initialized only during the init phase in the 'init_trusted' function and never changed. So, mark it as __ro_after_init.

---
 security/keys/trusted-keys/trusted_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/trusted-keys/trusted_core.c +1 -1
index 0b142d941..433579365 100644
@@ -59,7 +59,7 @@ DEFINE_STATIC_CALL_NULL(trusted_key_unseal,
 DEFINE_STATIC_CALL_NULL(trusted_key_get_random,
 			*trusted_key_sources[0].ops->get_random);
 static void (*trusted_key_exit)(void);
-static unsigned char migratable;
+static unsigned char migratable __ro_after_init;
 
 enum {
 	Opt_err,
Signature · 1 line
2.43.0

Thank you.

BR, Jarkko