diff options
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 2dd4dd6bdbc1..f21f1e0e6452 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -3176,18 +3176,17 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
3176 | if (!has_cap_mac_admin(true)) { | 3176 | if (!has_cap_mac_admin(true)) { |
3177 | struct audit_buffer *ab; | 3177 | struct audit_buffer *ab; |
3178 | size_t audit_size; | 3178 | size_t audit_size; |
3179 | const char *str; | ||
3180 | 3179 | ||
3181 | /* We strip a nul only if it is at the end, otherwise the | 3180 | /* We strip a nul only if it is at the end, otherwise the |
3182 | * context contains a nul and we should audit that */ | 3181 | * context contains a nul and we should audit that */ |
3183 | if (value) { | 3182 | if (value) { |
3184 | str = value; | 3183 | const char *str = value; |
3184 | |||
3185 | if (str[size - 1] == '\0') | 3185 | if (str[size - 1] == '\0') |
3186 | audit_size = size - 1; | 3186 | audit_size = size - 1; |
3187 | else | 3187 | else |
3188 | audit_size = size; | 3188 | audit_size = size; |
3189 | } else { | 3189 | } else { |
3190 | str = ""; | ||
3191 | audit_size = 0; | 3190 | audit_size = 0; |
3192 | } | 3191 | } |
3193 | ab = audit_log_start(current->audit_context, GFP_ATOMIC, AUDIT_SELINUX_ERR); | 3192 | ab = audit_log_start(current->audit_context, GFP_ATOMIC, AUDIT_SELINUX_ERR); |