lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b1fa42c0-bd8f-9090-a7b9-275b6b245aaf@linux.intel.com>
Date:   Mon, 31 Jan 2022 11:51:21 -0800 (PST)
From:   Mat Martineau <mathew.j.martineau@...ux.intel.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Matthieu Baerts <matthieu.baerts@...sares.net>,
        Jean Sacren <sakiwit@...il.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 5.16 137/200] mptcp: clean up harmless false
 expressions

On Mon, 31 Jan 2022, Greg Kroah-Hartman wrote:

> From: Jean Sacren <sakiwit@...il.com>
>
> [ Upstream commit 59060a47ca50bbdb1d863b73667a1065873ecc06 ]
>

Please drop this from the stable queue for both 5.15 and 5.16. This is a 
code cleanup (no functional change) patch that was originally merged in 
net-next and then got selected for stable.

It's pretty harmless to backport this one, but I hope this feedback is 
useful for tuning your scripts or manual patch review processes. If it's 
more helpful for me to let something like this slide by, or I'm 
misunderstanding how this might belong in the stable trees, I am likewise 
open to feedback!


Thanks,
Mat


> entry->addr.id is u8 with a range from 0 to 255 and MAX_ADDR_ID is 255.
> We should drop both false expressions of (entry->addr.id > MAX_ADDR_ID).
>
> We should also remove the obsolete parentheses in the first if branch.
>
> Use U8_MAX for MAX_ADDR_ID and add a comment to show the link to
> mptcp_addr_info.id as suggested by Mr. Matthieu Baerts.
>
> Reviewed-by: Matthieu Baerts <matthieu.baerts@...sares.net>
> Signed-off-by: Jean Sacren <sakiwit@...il.com>
> Signed-off-by: Mat Martineau <mathew.j.martineau@...ux.intel.com>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
> net/mptcp/pm_netlink.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index d18b13e3e74c6..27427aeeee0e5 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -38,7 +38,8 @@ struct mptcp_pm_add_entry {
> 	u8			retrans_times;
> };
>
> -#define MAX_ADDR_ID		255
> +/* max value of mptcp_addr_info.id */
> +#define MAX_ADDR_ID		U8_MAX
> #define BITMAP_SZ DIV_ROUND_UP(MAX_ADDR_ID + 1, BITS_PER_LONG)
>
> struct pm_nl_pernet {
> @@ -831,14 +832,13 @@ find_next:
> 		entry->addr.id = find_next_zero_bit(pernet->id_bitmap,
> 						    MAX_ADDR_ID + 1,
> 						    pernet->next_id);
> -		if ((!entry->addr.id || entry->addr.id > MAX_ADDR_ID) &&
> -		    pernet->next_id != 1) {
> +		if (!entry->addr.id && pernet->next_id != 1) {
> 			pernet->next_id = 1;
> 			goto find_next;
> 		}
> 	}
>
> -	if (!entry->addr.id || entry->addr.id > MAX_ADDR_ID)
> +	if (!entry->addr.id)
> 		goto out;
>
> 	__set_bit(entry->addr.id, pernet->id_bitmap);
> -- 
> 2.34.1
>
>
>
>

--
Mat Martineau
Intel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ