diff options
author | Konstantin Andreev <andreev@swemel.ru> | 2024-09-13 17:46:59 +0300 |
---|---|---|
committer | Casey Schaufler <casey@schaufler-ca.com> | 2024-12-06 13:21:12 -0800 |
commit | 6f71ad02aae83f7032255863e374acadaa852bea (patch) | |
tree | eccbba2661a0a792a244ff2997aeb7525b217570 /security/smack/smack_access.c | |
parent | 40384c840ea1944d7c5a392e8975ed088ecf0b37 (diff) |
smack: deduplicate access to string conversion
Signed-off-by: Konstantin Andreev <andreev@swemel.ru>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Diffstat (limited to 'security/smack/smack_access.c')
-rw-r--r-- | security/smack/smack_access.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c index 585e5e35710b..3727379623e2 100644 --- a/security/smack/smack_access.c +++ b/security/smack/smack_access.c @@ -275,7 +275,6 @@ int smk_curacc(struct smack_known *obj_known, return smk_tskacc(tsp, obj_known, mode, a); } -#ifdef CONFIG_AUDIT /** * smack_str_from_perm : helper to transalate an int to a * readable string @@ -283,7 +282,7 @@ int smk_curacc(struct smack_known *obj_known, * @access : the int * */ -static inline void smack_str_from_perm(char *string, int access) +int smack_str_from_perm(char *string, int access) { int i = 0; @@ -299,8 +298,15 @@ static inline void smack_str_from_perm(char *string, int access) string[i++] = 't'; if (access & MAY_LOCK) string[i++] = 'l'; + if (access & MAY_BRINGUP) + string[i++] = 'b'; + if (i == 0) + string[i++] = '-'; string[i] = '\0'; + return i; } + +#ifdef CONFIG_AUDIT /** * smack_log_callback - SMACK specific information * will be called by generic audit code |