Re: [PATCH net-next v14 12/13] net: ethtool: strset: Allow querying phy stats by index

From: Jakub Kicinski
Date: Wed Jul 03 2024 - 15:12:48 EST


On Wed, 3 Jul 2024 08:55:15 +0200 Maxime Chevallier wrote:
> > Elsewhere in this function it is assumed that info may be NULL.
> > But here it is dereferenced unconditionally.
>
> Hmm in almst all netlink commands we do dereference the genl_info *info
> pointer without checks.
>
> I've looked into net/netlink/genetlink.c to backtrack call-sites and it
> looks to be that indeed info can't be NULL (either populated from
> genl_start() or genl_family_rcv_msg_doit(). Maybe Jakub can confirm
> this ?
>
> If what I say above is correct, I can include a small patch to remove
> the un-necessary check that makes smatch think the genl_info pointer can
> be NULL.

The info used to be null during dumps, but I think we fixed that in
f946270d05c2 ("ethtool: netlink: always pass genl_info to .prepare_data")
Perhaps I should have cleaned up existing code :S