History

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)

Mimi Zohar committed 14 years ago

Commit 3db59dd1 parent 4bf19241 file · +2 −1Browse files

Unified · Split

security/integrity/ima/ima_policy.c+2−1
@@ -99,6 +99,7 @@ static bool ima_match_rules(struct ima_measure_rule_entry *rule, · 98 unmodified lines
9999 struct inode *inode, enum ima_hooks func, int mask)
100100 {
101101 struct task_struct *tsk = current;
102+ const struct cred *cred = current_cred();
102103 int i;
103104
104105 if ((rule->flags & IMA_FUNC) && rule->func != func)
@@ -108,7 +109,7 @@ static bool ima_match_rules(struct ima_measure_rule_entry *rule, · 3 unmodified lines
108109 if ((rule->flags & IMA_FSMAGIC)
109110 && rule->fsmagic != inode->i_sb->s_magic)
110111 return false;
111− if ((rule->flags & IMA_UID) && rule->uid != tsk->cred->uid)
112+ if ((rule->flags & IMA_UID) && rule->uid != cred->uid)
112113 return false;
113114 for (i = 0; i < MAX_LSM_RULES; i++) {
114115 int rc = 0;