From: Matthieu Baerts <matttbe@kernel.org>
To: Simon Horman <horms@kernel.org>
Cc: mptcp@lists.linux.dev, Mat Martineau <martineau@kernel.org>,
Geliang Tang <geliang@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 11/15] mptcp: pm: add id parameter for get_addr
Date: Fri, 17 Jan 2025 12:00:48 +0100 [thread overview]
Message-ID: <4453abfb-93ac-470e-b67e-71a918e7825c@kernel.org> (raw)
In-Reply-To: <20250117104336.GJ6206@kernel.org>
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@kylinos.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@kylinos.cn>
>> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
>> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.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.
next prev parent reply other threads:[~2025-01-17 11:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-16 16:51 [PATCH net-next 00/15] mptcp: pm: misc cleanups, part 2 Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 01/15] mptcp: pm: drop info of userspace_pm_remove_id_zero_address Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 02/15] mptcp: pm: userspace: flags: clearer msg if no remote addr Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 03/15] mptcp: pm: more precise error messages Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 04/15] mptcp: pm: improve " Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 05/15] mptcp: pm: userspace: use GENL_REQ_ATTR_CHECK Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 06/15] mptcp: pm: remove duplicated error messages Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 07/15] mptcp: pm: mark missing address attributes Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 08/15] mptcp: pm: use NL_SET_ERR_MSG_ATTR when possible Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 09/15] mptcp: pm: make three pm wrappers static Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 10/15] mptcp: pm: drop skb parameter of get_addr Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 11/15] mptcp: pm: add id parameter for get_addr Matthieu Baerts (NGI0)
2025-01-17 10:43 ` Simon Horman
2025-01-17 11:00 ` Matthieu Baerts [this message]
2025-01-16 16:51 ` [PATCH net-next 12/15] mptcp: pm: reuse sending nlmsg code in get_addr Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 13/15] mptcp: pm: drop skb parameter of set_flags Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 14/15] mptcp: pm: change rem type " Matthieu Baerts (NGI0)
2025-01-16 16:51 ` [PATCH net-next 15/15] mptcp: pm: add local parameter for set_flags Matthieu Baerts (NGI0)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4453abfb-93ac-470e-b67e-71a918e7825c@kernel.org \
--to=matttbe@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martineau@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®