diff options
| author | Tetsuo Handa <[email protected]> | 2013-07-24 20:44:02 +0000 |
|---|---|---|
| committer | James Morris <[email protected]> | 2013-07-25 09:30:03 +0000 |
| commit | 9548906b2bb7ff09e12c013a55d669bef2c8e121 (patch) | |
| tree | b75ba2bc69d82c1040cac0ea9113a17b39e82b93 /security/selinux/hooks.c | |
| parent | Merge branch 'linus-master'; commit 'v3.11-rc2' into ra-next (diff) | |
| download | kernel-9548906b2bb7ff09e12c013a55d669bef2c8e121.tar.gz kernel-9548906b2bb7ff09e12c013a55d669bef2c8e121.zip | |
xattr: Constify ->name member of "struct xattr".
Since everybody sets kstrdup()ed constant string to "struct xattr"->name but
nobody modifies "struct xattr"->name , we can omit kstrdup() and its failure
checking by constifying ->name member of "struct xattr".
Signed-off-by: Tetsuo Handa <[email protected]>
Reviewed-by: Joel Becker <[email protected]> [ocfs2]
Acked-by: Serge E. Hallyn <[email protected]>
Acked-by: Casey Schaufler <[email protected]>
Acked-by: Mimi Zohar <[email protected]>
Reviewed-by: Paul Moore <[email protected]>
Tested-by: Paul Moore <[email protected]>
Acked-by: Eric Paris <[email protected]>
Signed-off-by: James Morris <[email protected]>
Diffstat (limited to 'security/selinux/hooks.c')
| -rw-r--r-- | security/selinux/hooks.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index c956390a9136..a5091ec06aa6 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -2587,7 +2587,8 @@ static int selinux_dentry_init_security(struct dentry *dentry, int mode, } static int selinux_inode_init_security(struct inode *inode, struct inode *dir, - const struct qstr *qstr, char **name, + const struct qstr *qstr, + const char **name, void **value, size_t *len) { const struct task_security_struct *tsec = current_security(); @@ -2595,7 +2596,7 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir, struct superblock_security_struct *sbsec; u32 sid, newsid, clen; int rc; - char *namep = NULL, *context; + char *context; dsec = dir->i_security; sbsec = dir->i_sb->s_security; @@ -2631,19 +2632,13 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir, if (!ss_initialized || !(sbsec->flags & SE_SBLABELSUPP)) return -EOPNOTSUPP; - if (name) { - namep = kstrdup(XATTR_SELINUX_SUFFIX, GFP_NOFS); - if (!namep) - return -ENOMEM; - *name = namep; - } + if (name) + *name = XATTR_SELINUX_SUFFIX; if (value && len) { rc = security_sid_to_context_force(newsid, &context, &clen); - if (rc) { - kfree(namep); + if (rc) return rc; - } *value = context; *len = clen; } |
