diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2022-02-17 15:18:57 +0100 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2022-05-13 14:51:06 -0400 |
commit | 1af0e4a0233fea7e8226cb977d379dc20f9bbe11 (patch) | |
tree | b8f66a9f9847db2187757f50ae0c999b09e8caae /security | |
parent | c29722fad4aabbf6bb841b8f058f858ec911df56 (diff) | |
download | linux-1af0e4a0233fea7e8226cb977d379dc20f9bbe11.tar.gz linux-1af0e4a0233fea7e8226cb977d379dc20f9bbe11.tar.bz2 linux-1af0e4a0233fea7e8226cb977d379dc20f9bbe11.zip |
security: declare member holding string literal const
The struct security_hook_list member lsm is assigned in
security_add_hooks() with string literals passed from the individual
security modules. Declare the function parameter and the struct member
const to signal their immutability.
Reported by Clang [-Wwrite-strings]:
security/selinux/hooks.c:7388:63: error: passing 'const char [8]'
to parameter of type 'char *' discards qualifiers
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
security_add_hooks(selinux_hooks,
ARRAY_SIZE(selinux_hooks), selinux);
^~~~~~~~~
./include/linux/lsm_hooks.h:1629:11: note: passing argument to
parameter 'lsm' here
char *lsm);
^
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Reviewed-by: Paul Moore <paul@paul-moore.com>
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/security.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/security.c b/security/security.c index b7cf5cbfdc67..985afd150dd6 100644 --- a/security/security.c +++ b/security/security.c @@ -478,7 +478,7 @@ static int lsm_append(const char *new, char **result) * Each LSM has to register its hooks with the infrastructure. */ void __init security_add_hooks(struct security_hook_list *hooks, int count, - char *lsm) + const char *lsm) { int i; |