* [PATCH] Bluetooth: cmtp: Remove unnecessary null test
@ 2014-07-14 20:34 Himangi Saraogi
2014-07-14 21:02 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Himangi Saraogi @ 2014-07-14 20:34 UTC (permalink / raw)
To: Marcel Holtmann, Gustavo Padovan, Johan Hedberg, David S. Miller,
linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: julia.lawall-L2FTfq7BK8M
This patch removes the null test on ctrl. ctrl is initialized at the
beginning of the function to &session->ctrl. Since session is
dereferenced prior to the null test, session must be a valid pointer,
and &session->ctrl cannot be null.
The following Coccinelle script is used for detecting the change:
@r@
expression e,f;
identifier g,y;
statement S1,S2;
@@
*e = &f->g
<+...
f->y
...+>
*if (e != NULL || ...)
S1 else S2
Signed-off-by: Himangi Saraogi <himangi774-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org>
---
net/bluetooth/cmtp/capi.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c
index cd75e4d..1ca8a87 100644
--- a/net/bluetooth/cmtp/capi.c
+++ b/net/bluetooth/cmtp/capi.c
@@ -362,12 +362,6 @@ void cmtp_recv_capimsg(struct cmtp_session *session, struct sk_buff *skb)
CAPIMSG_SETCONTROL(skb->data, contr);
}
- if (!ctrl) {
- BT_ERR("Can't find controller %d for message", session->num);
- kfree_skb(skb);
- return;
- }
-
capi_ctr_handle_message(ctrl, appl, skb);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: cmtp: Remove unnecessary null test
2014-07-14 20:34 [PATCH] Bluetooth: cmtp: Remove unnecessary null test Himangi Saraogi
@ 2014-07-14 21:02 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2014-07-14 21:02 UTC (permalink / raw)
To: Himangi Saraogi
Cc: Gustavo F. Padovan, Johan Hedberg, David S. Miller,
Linux Bluetooth mailing list, Network Development, linux-kernel,
julia.lawall
Hi Himangi,
> This patch removes the null test on ctrl. ctrl is initialized at the
> beginning of the function to &session->ctrl. Since session is
> dereferenced prior to the null test, session must be a valid pointer,
> and &session->ctrl cannot be null.
>
> The following Coccinelle script is used for detecting the change:
>
> @r@
> expression e,f;
> identifier g,y;
> statement S1,S2;
> @@
>
> *e = &f->g
> <+...
> f->y
> ...+>
> *if (e != NULL || ...)
> S1 else S2
>
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> Acked-by: Julia Lawall <julia.lawall@lip6.fr>
> ---
> net/bluetooth/cmtp/capi.c | 6 ------
> 1 file changed, 6 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-14 21:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-14 20:34 [PATCH] Bluetooth: cmtp: Remove unnecessary null test Himangi Saraogi
2014-07-14 21:02 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox