mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
4bf1924c00
commit
3db59dd933
|
@ -99,6 +99,7 @@ static bool ima_match_rules(struct ima_measure_rule_entry *rule,
|
||||||
struct inode *inode, enum ima_hooks func, int mask)
|
struct inode *inode, enum ima_hooks func, int mask)
|
||||||
{
|
{
|
||||||
struct task_struct *tsk = current;
|
struct task_struct *tsk = current;
|
||||||
|
const struct cred *cred = current_cred();
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((rule->flags & IMA_FUNC) && rule->func != func)
|
if ((rule->flags & IMA_FUNC) && rule->func != func)
|
||||||
|
@ -108,7 +109,7 @@ static bool ima_match_rules(struct ima_measure_rule_entry *rule,
|
||||||
if ((rule->flags & IMA_FSMAGIC)
|
if ((rule->flags & IMA_FSMAGIC)
|
||||||
&& rule->fsmagic != inode->i_sb->s_magic)
|
&& rule->fsmagic != inode->i_sb->s_magic)
|
||||||
return false;
|
return false;
|
||||||
if ((rule->flags & IMA_UID) && rule->uid != tsk->cred->uid)
|
if ((rule->flags & IMA_UID) && rule->uid != cred->uid)
|
||||||
return false;
|
return false;
|
||||||
for (i = 0; i < MAX_LSM_RULES; i++) {
|
for (i = 0; i < MAX_LSM_RULES; i++) {
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
Loading…
Reference in New Issue