]> git.baikalelectronics.ru Git - kernel.git/commitdiff
IB/core: Fix static analysis warning in ib_policy_change_task
authorDaniel Jurgens <danielj@mellanox.com>
Wed, 5 Jul 2017 13:15:21 +0000 (16:15 +0300)
committerJames Morris <james.l.morris@oracle.com>
Thu, 6 Jul 2017 23:49:26 +0000 (09:49 +1000)
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 <danielj@mellanox.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
drivers/infiniband/core/device.c

index 631eaa9daf65d30156eafd29635315455c912dfa..a5dfab6adf495b88e846ee03b815536a7917bf48 100644 (file)
@@ -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);