[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231231154902.GD6849@unreal>
Date: Sun, 31 Dec 2023 17:49:02 +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 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
Powered by blists - more mailing lists