security/commoncap: Use xattr security prefix len
authorCarmeli Tamir <carmeli.tamir@gmail.com>
Sat, 6 Jul 2019 15:07:38 +0000 (11:07 -0400)
committerJames Morris <jamorris@linux.microsoft.com>
Sun, 7 Jul 2019 02:55:54 +0000 (14:55 +1200)
Using the existing defined XATTR_SECURITY_PREFIX_LEN instead of
sizeof(XATTR_SECURITY_PREFIX) - 1. Pretty simple cleanup.

Signed-off-by: Carmeli Tamir <carmeli.tamir@gmail.com>
Signed-off-by: James Morris <jamorris@linux.microsoft.com>
security/commoncap.c

index afd9679ca866974b14b2f7365b8d682b468ce863..1156178a0c52f74a314206003489eb44ad1ee058 100644 (file)
@@ -920,7 +920,7 @@ int cap_inode_setxattr(struct dentry *dentry, const char *name,
 
        /* Ignore non-security xattrs */
        if (strncmp(name, XATTR_SECURITY_PREFIX,
-                       sizeof(XATTR_SECURITY_PREFIX) - 1) != 0)
+                       XATTR_SECURITY_PREFIX_LEN) != 0)
                return 0;
 
        /*
@@ -952,7 +952,7 @@ int cap_inode_removexattr(struct dentry *dentry, const char *name)
 
        /* Ignore non-security xattrs */
        if (strncmp(name, XATTR_SECURITY_PREFIX,
-                       sizeof(XATTR_SECURITY_PREFIX) - 1) != 0)
+                       XATTR_SECURITY_PREFIX_LEN) != 0)
                return 0;
 
        if (strcmp(name, XATTR_NAME_CAPS) == 0) {