Commit a750cfde authored by Daniel Jurgens's avatar Daniel Jurgens Committed by James Morris

IB/core: Fix static analysis warning in ib_policy_change_task

ib_get_cached_subnet_prefix can technically fail, but the only way it
could is not possible based on the loop conditions. Check the return
value before using the variable sp to resolve a static analysis warning.

-v1:
- Fix check to !ret. Paul Moore

Fixes: 8f408ab6 ("selinux lsm IB/core: Implement LSM notification
system")
Signed-off-by: default avatarDaniel Jurgens <danielj@mellanox.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
parent 79d0636a
......@@ -376,7 +376,8 @@ static void ib_policy_change_task(struct work_struct *work)
WARN_ONCE(ret,
"ib_get_cached_subnet_prefix err: %d, this should never happen here\n",
ret);
ib_security_cache_change(dev, i, sp);
if (!ret)
ib_security_cache_change(dev, i, sp);
}
}
up_read(&lists_rwsem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment