From: Andrew Lunn <andrew@lunn•ch>
To: Daniil Tatianin <d-tatianin@yandex-team•ru>
Cc: netdev@vger•kernel.org, Michal Kubecek <mkubecek@suse•cz>,
yc-core@yandex-team•ru, lvc-project@linuxtesting•org
Subject: Re: [PATCH v1 3/3] net/ethtool/ioctl: correct & simplify ethtool_get_phy_stats if checks
Date: Mon, 28 Nov 2022 14:35:14 +0100 [thread overview]
Message-ID: <Y4S5EpZ3JrG0PstH@lunn.ch> (raw)
In-Reply-To: <11169dbe-2a26-6f31-3be6-f0439bb861f1@yandex-team.ru>
> 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
prev parent reply other threads:[~2022-11-28 13:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221125164913.360082-1-d-tatianin@yandex-team.ru>
[not found] ` <20221125164913.360082-2-d-tatianin@yandex-team.ru>
2022-11-25 19:02 ` [PATCH v1 1/3] net/ethtool/ioctl: return -EOPNOTSUPP if we have no phy stats Andrew Lunn
[not found] ` <20221125164913.360082-4-d-tatianin@yandex-team.ru>
2022-11-25 19:11 ` [PATCH v1 3/3] net/ethtool/ioctl: correct & simplify ethtool_get_phy_stats if checks Andrew Lunn
[not found] ` <55705e49-4b35-59be-5e41-7454dd12a0a4@yandex-team.ru>
2022-11-25 23:25 ` Andrew Lunn
[not found] ` <11169dbe-2a26-6f31-3be6-f0439bb861f1@yandex-team.ru>
2022-11-28 13:35 ` Andrew Lunn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y4S5EpZ3JrG0PstH@lunn.ch \
--to=andrew@lunn$(echo .)ch \
--cc=d-tatianin@yandex-team$(echo .)ru \
--cc=lvc-project@linuxtesting$(echo .)org \
--cc=mkubecek@suse$(echo .)cz \
--cc=netdev@vger$(echo .)kernel.org \
--cc=yc-core@yandex-team$(echo .)ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox