mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
c29722fad4
commit
1af0e4a023
2 changed files with 3 additions and 3 deletions
|
@ -1595,7 +1595,7 @@ struct security_hook_list {
|
|||
struct hlist_node list;
|
||||
struct hlist_head *head;
|
||||
union security_list_options hook;
|
||||
char *lsm;
|
||||
const char *lsm;
|
||||
} __randomize_layout;
|
||||
|
||||
/*
|
||||
|
@ -1630,7 +1630,7 @@ extern struct security_hook_heads security_hook_heads;
|
|||
extern char *lsm_names;
|
||||
|
||||
extern void security_add_hooks(struct security_hook_list *hooks, int count,
|
||||
char *lsm);
|
||||
const char *lsm);
|
||||
|
||||
#define LSM_FLAG_LEGACY_MAJOR BIT(0)
|
||||
#define LSM_FLAG_EXCLUSIVE BIT(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue