public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: bluetooth: clean up harmless false expression
@ 2021-12-08  7:20 Jεan Sacren
  2021-12-08 14:39 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Jεan Sacren @ 2021-12-08  7:20 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz, davem, kuba, linux-bluetooth,
	netdev

From: Jean Sacren <sakiwit@gmail.com>

scid is u16 with a range from 0x0000 to 0xffff.  L2CAP_CID_DYN_END is
0xffff.  We should drop the false check of (scid > L2CAP_CID_DYN_END).

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
---
 net/bluetooth/l2cap_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 4f8f37599962..fe5f455646f6 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4118,7 +4118,7 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
 	result = L2CAP_CR_NO_MEM;
 
 	/* Check for valid dynamic CID range (as per Erratum 3253) */
-	if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_DYN_END) {
+	if (scid < L2CAP_CID_DYN_START) {
 		result = L2CAP_CR_INVALID_SCID;
 		goto response;
 	}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: bluetooth: clean up harmless false expression
  2021-12-08  7:20 [PATCH net-next] net: bluetooth: clean up harmless false expression Jεan Sacren
@ 2021-12-08 14:39 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2021-12-08 14:39 UTC (permalink / raw)
  To: Jεan Sacren
  Cc: Johan Hedberg, Luiz Augusto von Dentz, David S. Miller,
	Jakub Kicinski, linux-bluetooth, netdev

Hi Jean,

> scid is u16 with a range from 0x0000 to 0xffff.  L2CAP_CID_DYN_END is
> 0xffff.  We should drop the false check of (scid > L2CAP_CID_DYN_END).
> 
> Signed-off-by: Jean Sacren <sakiwit@gmail.com>
> ---
> net/bluetooth/l2cap_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 4f8f37599962..fe5f455646f6 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -4118,7 +4118,7 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
> 	result = L2CAP_CR_NO_MEM;
> 
> 	/* Check for valid dynamic CID range (as per Erratum 3253) */
> -	if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_DYN_END) {
> +	if (scid < L2CAP_CID_DYN_START) {
> 		result = L2CAP_CR_INVALID_SCID;
> 		goto response;
> 	}

so I realize that this might be a pointless check, but I rather keep it. It
really doesn’t do any harm.

Regards

Marcel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-08 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-08  7:20 [PATCH net-next] net: bluetooth: clean up harmless false expression Jεan Sacren
2021-12-08 14:39 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox