[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211208024732.142541-6-sakiwit@gmail.com>
Date: Wed, 8 Dec 2021 00:20:26 -0700
From: Jεan Sacren <sakiwit@...il.com>
To: mathew.j.martineau@...ux.intel.com, matthieu.baerts@...sares.net,
davem@...emloft.net, kuba@...nel.org, netdev@...r.kernel.org,
mptcp@...ts.linux.dev
Subject: [PATCH net-next] net: mptcp: clean up harmless false expressions
From: Jean Sacren <sakiwit@...il.com>
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.
Signed-off-by: Jean Sacren <sakiwit@...il.com>
---
net/mptcp/pm_netlink.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 4ff8d55cbe82..233d4002c634 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -822,14 +822,13 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet,
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);
Powered by blists - more mailing lists