Skip to content

Commit

Permalink
IB/core: Fix static analysis warning in ib_policy_change_task
Browse files Browse the repository at this point in the history
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: 8f408ab ("selinux lsm IB/core: Implement LSM notification
system")
Signed-off-by: Daniel Jurgens <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
danielj-mellanox authored and James Morris committed Jul 6, 2017
1 parent 79d0636 commit a750cfd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/infiniband/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a750cfd

Please sign in to comment.