[PATCH mptcp-net v2 1/5] mptcp: pm: netlink: fix if-idx type

Matthieu Baerts (NGI0) posted 5 patches 1 week, 1 day ago
[PATCH mptcp-net v2 1/5] mptcp: pm: netlink: fix if-idx type
Posted by Matthieu Baerts (NGI0) 1 week, 1 day ago
As pointed out by Donald, when parsing an entry, the wrong type was set
for the temp value: this value is signed.

There are no real issues here, because the intermediate variable was
only wrong for the sign, not for the size, and the final variable had
the right sign. But this feels wrong, and is confusing.

Fixes: ef0da3b8a2f1 ("mptcp: move address attribute into mptcp_addr_info")
Reported-by: Donald Hunter <donald.hunter@gmail.com>
Closes: https://lore.kernel.org/m2plc0ui9z.fsf@gmail.com
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/pm_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 50aaf259959aeaf36e7ab954c6f7957eaf2bc390..2225b1c5b96666cd4121854c967a7f3a79824047 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -113,7 +113,7 @@ int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info,
 		return err;
 
 	if (tb[MPTCP_PM_ADDR_ATTR_IF_IDX]) {
-		u32 val = nla_get_s32(tb[MPTCP_PM_ADDR_ATTR_IF_IDX]);
+		s32 val = nla_get_s32(tb[MPTCP_PM_ADDR_ATTR_IF_IDX]);
 
 		entry->ifindex = val;
 	}

-- 
2.51.0
Re: [PATCH mptcp-net v2 1/5] mptcp: pm: netlink: fix if-idx type
Posted by Matthieu Baerts 1 week ago
Hello,

On 09/09/2025 16:33, Matthieu Baerts (NGI0) wrote:
> As pointed out by Donald, when parsing an entry, the wrong type was set
> for the temp value: this value is signed.
> 
> There are no real issues here, because the intermediate variable was
> only wrong for the sign, not for the size, and the final variable had
> the right sign. But this feels wrong, and is confusing.

As pointed out by Jakub in [1], this patch can go to -next.

I suggest modifying the commit message when applying the patch by
removing the Fixes that, and adding:

  ... and is confusing, so fixing this small typo introduced in commit
  ef0da3b8a2f1 ("mptcp: move address attribute into mptcp_addr_info").

[1] https://lore.kernel.org/20250909184221.02b070b0@kernel.org

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.