mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
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 <penguin-kernel@I-love.SAKURA.ne.jp> Reviewed-by: Joel Becker <jlbec@evilplan.org> [ocfs2] Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com> Acked-by: Casey Schaufler <casey@schaufler-ca.com> Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Reviewed-by: Paul Moore <paul@paul-moore.com> Tested-by: Paul Moore <paul@paul-moore.com> Acked-by: Eric Paris <eparis@redhat.com> Signed-off-by: James Morris <james.l.morris@oracle.com>
This commit is contained in:
parent
be0306bcc3
commit
9548906b2b
9 changed files with 21 additions and 31 deletions
|
|
@ -348,10 +348,10 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
|
|||
if (unlikely(IS_PRIVATE(inode)))
|
||||
return 0;
|
||||
|
||||
memset(new_xattrs, 0, sizeof new_xattrs);
|
||||
if (!initxattrs)
|
||||
return security_ops->inode_init_security(inode, dir, qstr,
|
||||
NULL, NULL, NULL);
|
||||
memset(new_xattrs, 0, sizeof(new_xattrs));
|
||||
lsm_xattr = new_xattrs;
|
||||
ret = security_ops->inode_init_security(inode, dir, qstr,
|
||||
&lsm_xattr->name,
|
||||
|
|
@ -366,16 +366,14 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
|
|||
goto out;
|
||||
ret = initxattrs(inode, new_xattrs, fs_data);
|
||||
out:
|
||||
for (xattr = new_xattrs; xattr->name != NULL; xattr++) {
|
||||
kfree(xattr->name);
|
||||
for (xattr = new_xattrs; xattr->value != NULL; xattr++)
|
||||
kfree(xattr->value);
|
||||
}
|
||||
return (ret == -EOPNOTSUPP) ? 0 : ret;
|
||||
}
|
||||
EXPORT_SYMBOL(security_inode_init_security);
|
||||
|
||||
int security_old_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)
|
||||
{
|
||||
if (unlikely(IS_PRIVATE(inode)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue