[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4453abfb-93ac-470e-b67e-71a918e7825c@kernel.org>
Date: Fri, 17 Jan 2025 12:00:48 +0100
From: Matthieu Baerts <matttbe@...nel.org>
To: Simon Horman <horms@...nel.org>
Cc: mptcp@...ts.linux.dev, Mat Martineau <martineau@...nel.org>,
Geliang Tang <geliang@...nel.org>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 11/15] mptcp: pm: add id parameter for get_addr
Hi Simon,
On 17/01/2025 11:43, Simon Horman wrote:
> On Thu, Jan 16, 2025 at 05:51:33PM +0100, Matthieu Baerts (NGI0) wrote:
>> From: Geliang Tang <tanggeliang@...inos.cn>
>>
>> The address id is parsed both in mptcp_pm_nl_get_addr() and
>> mptcp_userspace_pm_get_addr(), this makes the code somewhat repetitive.
>>
>> So this patch adds a new parameter 'id' for all get_addr() interfaces.
>> The address id is only parsed in mptcp_pm_nl_get_addr_doit(), then pass
>> it to both mptcp_pm_nl_get_addr() and mptcp_userspace_pm_get_addr().
>>
>> Signed-off-by: Geliang Tang <tanggeliang@...inos.cn>
>> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@...nel.org>
>> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@...nel.org>
>
> ...
>
>> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
>> index 853b1ea8680ae753fcb882d8b8f4486519798503..392f91dd21b4ce07efb5f44c701f2261afcdc37e 100644
>> --- a/net/mptcp/pm_netlink.c
>> +++ b/net/mptcp/pm_netlink.c
>> @@ -1773,23 +1773,15 @@ int mptcp_nl_fill_addr(struct sk_buff *skb,
>> return -EMSGSIZE;
>> }
>>
>> -int mptcp_pm_nl_get_addr(struct genl_info *info)
>> +int mptcp_pm_nl_get_addr(u8 id, struct genl_info *info)
>> {
>> struct pm_nl_pernet *pernet = genl_info_pm_nl(info);
>> - struct mptcp_pm_addr_entry addr, *entry;
>> + struct mptcp_pm_addr_entry *entry;
>> struct sk_buff *msg;
>> struct nlattr *attr;
>> void *reply;
>> int ret;
>>
>> - if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ENDPOINT_ADDR))
>> - return -EINVAL;
>> -
>> - attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR];
>> - ret = mptcp_pm_parse_entry(attr, info, false, &addr);
>> - if (ret < 0)
>> - return ret;
>> -
>
> Hi Matthieu and Geliang,
>
> This hunk removes the initialisation of attr...
>
>> msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
>> if (!msg)
>> return -ENOMEM;
>> @@ -1803,7 +1795,7 @@ int mptcp_pm_nl_get_addr(struct genl_info *info)
>> }
>>
>> rcu_read_lock();
>> - entry = __lookup_addr_by_id(pernet, addr.addr.id);
>> + entry = __lookup_addr_by_id(pernet, id);
>> if (!entry) {
>> NL_SET_ERR_MSG_ATTR(info->extack, attr, "address not found");
>
> ... but attr is still used here.
>
> Flagged by clang-19 W=1 builds and Smatch.
Thank you for having looked at that!
Indeed, I missed that when rebasing and fixing conflicts, my bad, sorry.
This part of the code is moved in the patch to pm.c, where 'attr' is
initialised properly. What's a shame is that, just before sending the
series, I thought about squashing this patch with the next one :)
Anyway, I will fix that in a v2.
I hope that's OK if I add an extra patch in the same series or in parallel.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
Powered by blists - more mailing lists