aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorJulien Brunel <brunel@diku.dk>2008-10-10 15:00:19 -0400
committerRoland Dreier <rolandd@cisco.com>2008-10-10 15:00:19 -0400
commit6aea938f54ca785ce3bea67a8948698225c6ca58 (patch)
tree0073e089b5c10a5baf116f4978480259c366ec89 /drivers/infiniband
parentf6bccf695431da0e9bd773550ae91b8cb9ffb227 (diff)
RDMA/ucma: Test ucma_alloc_multicast() return against NULL, not with IS_ERR()
In case of error, the function ucma_alloc_multicast() returns a NULL pointer, but never returns an ERR pointer. So after a call to this function, an IS_ERR test should be replaced by a NULL test. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @match bad_is_err_test@ expression x, E; @@ x = ucma_alloc_multicast(...) ... when != x = E IS_ERR(x) // </smpl> Signed-off-by: Julien Brunel <brunel@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/ucma.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index 3ddacf39b7ba..4346a24568fb 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -904,8 +904,8 @@ static ssize_t ucma_join_multicast(struct ucma_file *file,
904 904
905 mutex_lock(&file->mut); 905 mutex_lock(&file->mut);
906 mc = ucma_alloc_multicast(ctx); 906 mc = ucma_alloc_multicast(ctx);
907 if (IS_ERR(mc)) { 907 if (!mc) {
908 ret = PTR_ERR(mc); 908 ret = -ENOMEM;
909 goto err1; 909 goto err1;
910 } 910 }
911 911