Re: [PATCH net] net/mlx5: fix invalid structure access

From: Alexander Lobakin
Date: Mon May 30 2022 - 05:55:26 EST


From: Saeed Mahameed <saeed@xxxxxxxxxx>
Date: Fri, 27 May 2022 15:29:05 -0700

On 27 May 13:01, Alexander Lobakin wrote:
>After pulling latest bpf-next, I started catching the following:

[...]

We have a similar patch that is being reviewed internally.
I don't like comparing strings to match devices. Also this could cause mlx5
unwanted aux devices to be matched, e.g mlx5e, mlx5_ib, mlx5v, etc .., since
they all share the same prefix ? yes, no ?
We also have another patch/approach that is comparing drivers:

if (dev->driver != curr->device->driver)
return NULL;

But also this is under discussion.

Ok, I spotted that implementation in your repo at korg, hope it will
hit mainline trees soon.


I think the whole design of this function is wrong, it's being used to match
devices of type mlx5_core_dev which are pci devices, but it is using aux class
to lookup! It works since we always have some aux devices hanging on top of
mlx5_core pci devs and since all of them share the same wrapper structure
"mlx5_adev" we find the corresponding mdev "mlx5_core_dev" sort of correctly.

[...]

>-- >2.36.1

Thanks,
Al