Subject: Re: [PATCH v1 3/3] net/ethtool/ioctl: correct & simplify ethtool_get_phy_stats if checks

From: Andrew Lunn <[email-masked]>
Date: Mon, 28 Nov 2022 14:35:14 +0100

> 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