diff mbox series

[net-next] net: bluetooth: clean up harmless false expression

Message ID 20211208024732.142541-4-sakiwit@gmail.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: bluetooth: clean up harmless false expression | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jεan Sacren Dec. 8, 2021, 7:20 a.m. UTC
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(-)

Comments

Marcel Holtmann Dec. 8, 2021, 2:39 p.m. UTC | #1
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
diff mbox series

Patch

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;
 	}