From: Daniel Jurgens Date: Wed, 5 Jul 2017 13:15:21 +0000 (+0300) Subject: IB/core: Fix static analysis warning in ib_policy_change_task X-Git-Tag: v4.14-rc1~544^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a750cfde1397dbbee1efe7737c2e952d6fc2d878;p=platform%2Fkernel%2Flinux-rpi3.git 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: 8f408ab64be6 ("selinux lsm IB/core: Implement LSM notification system") Signed-off-by: Daniel Jurgens Reported-by: Dan Carpenter Signed-off-by: Paul Moore Signed-off-by: James Morris --- diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 631eaa9..a5dfab6 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -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);