mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Lin Ma" <linma@zju.edu.cn>
To: "Leon Romanovsky" <leon@kernel.org>
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: Sun, 31 Dec 2023 13:27:59 +0800 (GMT+08:00)	[thread overview]
Message-ID: <7d95dbb5.63777.18cbe57e107.Coremail.linma@zju.edu.cn> (raw)
In-Reply-To: <20231230154422.GB6849@unreal>

Hello Leon,

> > 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?
> 

To my concern, the nla_validate_deprecated, compared to nla_parse_deprecated,
will at lease save a memset in function nla_parse_deprecated

```
if (tb)
    memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
```

Morever, because the `nla_validate_deprecated` just validate the attributes
array and will not try to retrieve the nla pointers. It shall be faster
and cleaner here :D.

Regards
Lin

  reply	other threads:[~2023-12-31  5:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-30  5:19 Lin Ma
2023-12-30 15:44 ` Leon Romanovsky
2023-12-31  5:27   ` Lin Ma [this message]
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=7d95dbb5.63777.18cbe57e107.Coremail.linma@zju.edu.cn \
    --to=linma@zju.edu.cn \
    --cc=bvanassche@acm.org \
    --cc=gustavoars@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --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

all inboxes | Powered by JetHome®