* [PATCH] drivers/infiniband/core: Use a NULL test rather than an IS_ERR test
@ 2008-08-28 13:31 Julien Brunel
2008-09-02 20:26 ` Roland Dreier
0 siblings, 1 reply; 2+ messages in thread
From: Julien Brunel @ 2008-08-28 13:31 UTC (permalink / raw)
To: rolandd, sean.hefty, hal.rosenstock, general, linux-kernel,
kernel-janitors
From: Julien Brunel <brunel@diku.dk>
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>
---
drivers/infiniband/core/ucma.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff -u -p a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -904,8 +904,8 @@ static ssize_t ucma_join_multicast(struc
mutex_lock(&file->mut);
mc = ucma_alloc_multicast(ctx);
- if (IS_ERR(mc)) {
- ret = PTR_ERR(mc);
+ if (mc == NULL) {
+ ret = -ENOMEM;
goto err1;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/infiniband/core: Use a NULL test rather than an IS_ERR test
2008-08-28 13:31 [PATCH] drivers/infiniband/core: Use a NULL test rather than an IS_ERR test Julien Brunel
@ 2008-09-02 20:26 ` Roland Dreier
0 siblings, 0 replies; 2+ messages in thread
From: Roland Dreier @ 2008-09-02 20:26 UTC (permalink / raw)
To: Julien Brunel
Cc: rolandd, sean.hefty, hal.rosenstock, general, linux-kernel,
kernel-janitors
thanks, applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-02 20:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-28 13:31 [PATCH] drivers/infiniband/core: Use a NULL test rather than an IS_ERR test Julien Brunel
2008-09-02 20:26 ` Roland Dreier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).