[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250117104336.GJ6206@kernel.org>
Date: Fri, 17 Jan 2025 10:43:36 +0000
From: Simon Horman <horms@...nel.org>
To: "Matthieu Baerts (NGI0)" <matttbe@...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
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.
> ret = -EINVAL;
...
Powered by blists - more mailing lists