linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Lin Ma <linma@zju.edu.cn>
Cc: jgg@ziepe.ca, gustavoars@kernel.org, bvanassche@acm.org,
	markzhang@nvidia.com, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] RDMA/sa_query: use validate not parser in ib_nl_is_good_resolve_resp
Date: Sat, 30 Dec 2023 17:44:22 +0200	[thread overview]
Message-ID: <20231230154422.GB6849@unreal> (raw)
In-Reply-To: <20231230051956.82499-1-linma@zju.edu.cn>

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@zju.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
> 

  reply	other threads:[~2023-12-30 15:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-30  5:19 [PATCH v1] RDMA/sa_query: use validate not parser in ib_nl_is_good_resolve_resp Lin Ma
2023-12-30 15:44 ` Leon Romanovsky [this message]
2023-12-31  5:27   ` Lin Ma
2023-12-31 15:49     ` Leon Romanovsky

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=20231230154422.GB6849@unreal \
    --to=leon@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=gustavoars@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linma@zju.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=markzhang@nvidia.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;
as well as URLs for NNTP newsgroup(s).