linux/drivers/isdn/capi
Julia Lawall 4d5392cc4d drivers/isdn/capi/kcapi.c: Adjust error handling code involving capi_ctr_put
After calling capi_ctr_get, error handling code should call capi_ctr_put.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r@
expression x,E;
statement S;
position p1,p2,p3;
@@

(
if ((x = capi_ctr_get@p1(...)) == NULL || ...) S
|
x = capi_ctr_get@p1(...)
... when != x
if (x == NULL || ...) S
)
<...
if@p3 (...) { ... when != capi_ctr_put(x)
                  when != if (x) { ... capi_ctr_put(x); ...}
    return@p2 ...;
}
...>
(
return x;
|
return 0;
|
x = E
|
E = x
|
capi_ctr_put(x)
)

@exists@
position r.p1,r.p2,r.p3;
expression x;
int ret != 0;
statement S;
@@

* x = capi_ctr_get@p1(...)
  <...
* if@p3 (...)
  S
  ...>
* return@p2 \(NULL\|ret\);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-22 19:04:54 -07:00
..
capi.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6 2008-07-22 13:13:47 -07:00
capidrv.c isdn: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:34 -07:00
capidrv.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
capifs.c capifs: fix memory leak on remount 2008-04-28 08:58:34 -07:00
capifs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
capilib.c isdn: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:34 -07:00
capiutil.c isdn/capi: Return proper errnos on module init. 2008-05-14 23:30:06 -07:00
kcapi_proc.c isdn: use non-racy method for proc entries creation 2008-04-29 08:06:22 -07:00
kcapi.c drivers/isdn/capi/kcapi.c: Adjust error handling code involving capi_ctr_put 2008-09-22 19:04:54 -07:00
kcapi.h isdn: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:34 -07:00
Kconfig Use menuconfig objects: ISDN: CONFIG_ISDN_CAPI 2007-07-17 10:23:05 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00