aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2017-10-14 08:46:55 -0400
committerPaul Moore <paul@paul-moore.com>2017-10-16 18:34:25 -0400
commitadd24372141855b057bf53982824c5fe50898957 (patch)
tree71759987310723d0cbfd85a535d3c0a3a7e26ffd
parent4298555df5e5cb956549de5b01e4c77b1e4bc00a (diff)
selinux: remove redundant assignment to str
str is being assigned to an empty string but str is never being read after that, so the assignment is redundant and can be removed. Moving the declaration of str to a more localised block, cleans up clang warning: "Value stored to 'str' is never read" Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
-rw-r--r--security/selinux/hooks.c5
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);