[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231230154422.GB6849@unreal>
Date: Sat, 30 Dec 2023 17:44:22 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Lin Ma <linma@....edu.cn>
Cc: jgg@...pe.ca, gustavoars@...nel.org, bvanassche@....org,
markzhang@...dia.com, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] RDMA/sa_query: use validate not parser in
ib_nl_is_good_resolve_resp
On Sat, Dec 30, 2023 at 01:19:56PM +0800, Lin Ma wrote:
> The attributes array `tb` in ib_nl_is_good_resolve_resp is never used
> after the parsing. Therefore use nla_validate_deprecated function here
> for improvement.
What did this change improve?
>
> Signed-off-by: Lin Ma <linma@....edu.cn>
> ---
> drivers/infiniband/core/sa_query.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
> index 8175dde60b0a..c7407a53fcda 100644
> --- a/drivers/infiniband/core/sa_query.c
> +++ b/drivers/infiniband/core/sa_query.c
> @@ -1047,14 +1047,13 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb,
>
> static inline int ib_nl_is_good_resolve_resp(const struct nlmsghdr *nlh)
> {
> - struct nlattr *tb[LS_NLA_TYPE_MAX];
> int ret;
>
> if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR)
> return 0;
>
> - ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh),
> - nlmsg_len(nlh), ib_nl_policy, NULL);
> + ret = nla_validate_deprecated(nlmsg_data(nlh), nlmsg_len(nlh),
> + LS_NLA_TYPE_MAX - 1, ib_nl_policy, NULL);
> if (ret)
> return 0;
>
> --
> 2.17.1
>
Powered by blists - more mailing lists