* [PATCH 4/7] net/bluetooth/rfcomm/core.c: fix error return code [not found] <1346258957-7649-1-git-send-email-Julia.Lawall@lip6.fr> @ 2012-08-29 16:49 ` Julia Lawall 2012-08-29 18:23 ` Marcel Holtmann 0 siblings, 1 reply; 2+ messages in thread From: Julia Lawall @ 2012-08-29 16:49 UTC (permalink / raw) To: Marcel Holtmann Cc: kernel-janitors, Gustavo Padovan, Johan Hedberg, David S. Miller, linux-bluetooth, netdev, linux-kernel From: Julia Lawall <Julia.Lawall@lip6.fr> Initialize return variable before exiting on an error path. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- net/bluetooth/rfcomm/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index c75107e..30141c0 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -2010,8 +2010,10 @@ static int rfcomm_add_listener(bdaddr_t *ba) /* Add listening session */ s = rfcomm_session_add(sock, BT_LISTEN); - if (!s) + if (!s) { + err = -ENOMEM; goto failed; + } rfcomm_session_hold(s); return 0; ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 4/7] net/bluetooth/rfcomm/core.c: fix error return code 2012-08-29 16:49 ` [PATCH 4/7] net/bluetooth/rfcomm/core.c: fix error return code Julia Lawall @ 2012-08-29 18:23 ` Marcel Holtmann 0 siblings, 0 replies; 2+ messages in thread From: Marcel Holtmann @ 2012-08-29 18:23 UTC (permalink / raw) To: Julia Lawall Cc: kernel-janitors, Gustavo Padovan, Johan Hedberg, David S. Miller, linux-bluetooth, netdev, linux-kernel Hi Julia, > Initialize return variable before exiting on an error path. > > A simplified version of the semantic match that finds this problem is as > follows: (http://coccinelle.lip6.fr/) > > // <smpl> > ( > if@p1 (\(ret < 0\|ret != 0\)) > { ... return ret; } > | > ret@p1 = 0 > ) > ... when != ret = e1 > when != &ret > *if(...) > { > ... when != ret = e2 > when forall > return ret; > } > > // </smpl> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> > > --- > net/bluetooth/rfcomm/core.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Acked-by: Marcel Holtmann <marcel@holtmann.org> Regards Marcel ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-29 18:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1346258957-7649-1-git-send-email-Julia.Lawall@lip6.fr>
2012-08-29 16:49 ` [PATCH 4/7] net/bluetooth/rfcomm/core.c: fix error return code Julia Lawall
2012-08-29 18:23 ` Marcel Holtmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox