diff options
author | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2012-01-17 22:11:28 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2012-01-18 23:59:11 -0500 |
commit | 3db59dd93309710c40aaf1571c607cb0feef3ecb (patch) | |
tree | 6a224a855aad0e5207abae573456b2d2ec381f7c /security/integrity | |
parent | 4bf1924c008dffdc154f82507b4052e49263a6f4 (diff) |
ima: fix cred sparse warning
Fix ima_policy.c sparse "warning: dereference of noderef expression"
message, by accessing cred->uid using current_cred().
Changelog v1:
- Change __cred to just cred (based on David Howell's comment)
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/integrity')
-rw-r--r-- | security/integrity/ima/ima_policy.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index d661afbe474c..d45061d02fee 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c | |||
@@ -99,6 +99,7 @@ static bool ima_match_rules(struct ima_measure_rule_entry *rule, | |||
99 | struct inode *inode, enum ima_hooks func, int mask) | 99 | struct inode *inode, enum ima_hooks func, int mask) |
100 | { | 100 | { |
101 | struct task_struct *tsk = current; | 101 | struct task_struct *tsk = current; |
102 | const struct cred *cred = current_cred(); | ||
102 | int i; | 103 | int i; |
103 | 104 | ||
104 | if ((rule->flags & IMA_FUNC) && rule->func != func) | 105 | if ((rule->flags & IMA_FUNC) && rule->func != func) |
@@ -108,7 +109,7 @@ static bool ima_match_rules(struct ima_measure_rule_entry *rule, | |||
108 | if ((rule->flags & IMA_FSMAGIC) | 109 | if ((rule->flags & IMA_FSMAGIC) |
109 | && rule->fsmagic != inode->i_sb->s_magic) | 110 | && rule->fsmagic != inode->i_sb->s_magic) |
110 | return false; | 111 | return false; |
111 | if ((rule->flags & IMA_UID) && rule->uid != tsk->cred->uid) | 112 | if ((rule->flags & IMA_UID) && rule->uid != cred->uid) |
112 | return false; | 113 | return false; |
113 | for (i = 0; i < MAX_LSM_RULES; i++) { | 114 | for (i = 0; i < MAX_LSM_RULES; i++) { |
114 | int rc = 0; | 115 | int rc = 0; |