[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <0A76D564-1A23-4FCE-BA8D-578C161475BF@holtmann.org>
Date: Wed, 8 Dec 2021 15:39:05 +0100
From: Marcel Holtmann <marcel@...tmann.org>
To: Jεan Sacren <sakiwit@...il.com>
Cc: Johan Hedberg <johan.hedberg@...il.com>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
linux-bluetooth <linux-bluetooth@...r.kernel.org>,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net: bluetooth: clean up harmless false
expression
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@...il.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
Powered by blists - more mailing lists