Re: [PATCH v1] RDMA/nldev: Add length check for IFLA_BOND_ARP_IP_TARGET parsing

From: Lin Ma
Date: Tue Jul 25 2023 - 01:34:37 EST


Hi Leon,

>
> Right, and this is what bothers me.
>
> I would more than happy to change nla_for_each_nested() to be something
> like nla_for_each_nested_type(...., sizeof(u32)), which will skip empty
> lines, for code which can't have them.
>
> Thanks
>

Well, nla_for_each_nested_type(...., sizeof(u32)) seems good if the nested
attribute is sure to contain only one type of attribute with constant length.
(like the case of RDMA_NLDEV_ATTR_STAT_HWCOUNTERS).

I accept that it is another elegant solution here. But efforts are needed to
make sure if this is true for other cases.

Regards
Lin