diff options
| author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2013-07-24 16:44:02 -0400 |
|---|---|---|
| committer | James Morris <james.l.morris@oracle.com> | 2013-07-25 05:30:03 -0400 |
| commit | 9548906b2bb7ff09e12c013a55d669bef2c8e121 (patch) | |
| tree | b75ba2bc69d82c1040cac0ea9113a17b39e82b93 /security/smack | |
| parent | be0306bcc3a0b0725b0f99b06d56a29a6d906b7c (diff) | |
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>
Diffstat (limited to 'security/smack')
| -rw-r--r-- | security/smack/smack_lsm.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 3f7682a387b7..a113a779f00c 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
| @@ -582,7 +582,7 @@ static void smack_inode_free_security(struct inode *inode) | |||
| 582 | * Returns 0 if it all works out, -ENOMEM if there's no memory | 582 | * Returns 0 if it all works out, -ENOMEM if there's no memory |
| 583 | */ | 583 | */ |
| 584 | static int smack_inode_init_security(struct inode *inode, struct inode *dir, | 584 | static int smack_inode_init_security(struct inode *inode, struct inode *dir, |
| 585 | const struct qstr *qstr, char **name, | 585 | const struct qstr *qstr, const char **name, |
| 586 | void **value, size_t *len) | 586 | void **value, size_t *len) |
| 587 | { | 587 | { |
| 588 | struct inode_smack *issp = inode->i_security; | 588 | struct inode_smack *issp = inode->i_security; |
| @@ -591,11 +591,8 @@ static int smack_inode_init_security(struct inode *inode, struct inode *dir, | |||
| 591 | char *dsp = smk_of_inode(dir); | 591 | char *dsp = smk_of_inode(dir); |
| 592 | int may; | 592 | int may; |
| 593 | 593 | ||
| 594 | if (name) { | 594 | if (name) |
| 595 | *name = kstrdup(XATTR_SMACK_SUFFIX, GFP_NOFS); | 595 | *name = XATTR_SMACK_SUFFIX; |
| 596 | if (*name == NULL) | ||
| 597 | return -ENOMEM; | ||
| 598 | } | ||
| 599 | 596 | ||
| 600 | if (value) { | 597 | if (value) { |
| 601 | rcu_read_lock(); | 598 | rcu_read_lock(); |
