public inbox for linux-kernel@vger.kernel.org
 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: Sun, 31 Dec 2023 17:49:02 +0200	[thread overview]
Message-ID: <20231231154902.GD6849@unreal> (raw)
In-Reply-To: <7d95dbb5.63777.18cbe57e107.Coremail.linma@zju.edu.cn>

On Sun, Dec 31, 2023 at 01:27:59PM +0800, Lin Ma wrote:
> 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.

We don't care about speed in this path.
Let's leave the code as is.

Thanks

> 
> Regards
> Lin

      reply	other threads:[~2023-12-31 15:49 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
2023-12-31  5:27   ` Lin Ma
2023-12-31 15:49     ` Leon Romanovsky [this message]

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=20231231154902.GD6849@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