[lvc-project] [PATCH v1 3/3] net/ethtool/ioctl: correct & simplify ethtool_get_phy_stats if checks

Andrew Lunn andrew at lunn.ch
Mon Nov 28 16:35:14 MSK 2022


> I guess this does indeed look cleaner although I'm not sure about the
> duplicated n_stats validation code. Maybe this could be moved to a separate
> helper as well or do you think it's okay to duplicate it in this case?

Yes, the validation and the memory allocation could be pulled out into
a helper.

The main thing here is that the code is pretty much identical for the
two functions. If one is correct, the other is also correct. There is
no access in an else branch which can be overlooked.

  Andrew



More information about the lvc-project mailing list