Re: [PATCH v1] RDMA/sa_query: use validate not parser in ib_nl_is_good_resolve_resp

From: Leon Romanovsky
Date: Sun Dec 31 2023 - 10:49:17 EST


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