From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Su Hui <suhui@nfschina.com>
Cc: alexanderduyck@fb.com, kuba@kernel.org, kernel-team@meta.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org, mohsin.bashr@gmail.com,
sanmanpradhan@meta.com, kalesh-anakkur.purayil@broadcom.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] eth: fbnic: Avoid garbage value in fbnic_mac_get_sensor_asic()
Date: Mon, 30 Dec 2024 09:00:20 +0100 [thread overview]
Message-ID: <Z3JTFJgbzX4XGHwG@mev-dev.igk.intel.com> (raw)
In-Reply-To: <20241230014242.14562-1-suhui@nfschina.com>
On Mon, Dec 30, 2024 at 09:42:43AM +0800, Su Hui wrote:
> 'fw_cmpl' is uninitialized which makes 'sensor' and '*val' to be stored
> garbage value. Remove the whole body of fbnic_mac_get_sensor_asic() and
> return -EOPNOTSUPP to fix this problem.
>
> Fixes: d85ebade02e8 ("eth: fbnic: Add hardware monitoring support via HWMON interface")
> Signed-off-by: Su Hui <suhui@nfschina.com>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> ---
> drivers/net/ethernet/meta/fbnic/fbnic_mac.c | 18 +-----------------
> 1 file changed, 1 insertion(+), 17 deletions(-)
>
> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_mac.c b/drivers/net/ethernet/meta/fbnic/fbnic_mac.c
> index 80b82ff12c4d..dd28c0f4c4b0 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_mac.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_mac.c
> @@ -688,23 +688,7 @@ fbnic_mac_get_eth_mac_stats(struct fbnic_dev *fbd, bool reset,
>
> static int fbnic_mac_get_sensor_asic(struct fbnic_dev *fbd, int id, long *val)
> {
> - struct fbnic_fw_completion fw_cmpl;
Probably it should be:
*fw_cmpl = fbd->cmpl_data
but it is also never initialized.
> - s32 *sensor;
> -
> - switch (id) {
> - case FBNIC_SENSOR_TEMP:
> - sensor = &fw_cmpl.tsene.millidegrees;
> - break;
> - case FBNIC_SENSOR_VOLTAGE:
> - sensor = &fw_cmpl.tsene.millivolts;
> - break;
> - default:
> - return -EINVAL;
> - }
> -
> - *val = *sensor;
> -
> - return 0;
> + return -EOPNOTSUPP;
It is more like removing broken functionality than fixing (maybe whole
commit should be reverted). Anyway returning not support is also fine.
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> }
>
> static const struct fbnic_mac fbnic_mac_asic = {
> --
> 2.30.2
next prev parent reply other threads:[~2024-12-30 8:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-30 1:42 [PATCH v2] eth: fbnic: Avoid garbage value in fbnic_mac_get_sensor_asic() Su Hui
2024-12-30 8:00 ` Michal Swiatkowski [this message]
2024-12-30 16:52 ` Jakub Kicinski
2025-01-03 18:07 ` Jakub Kicinski
2025-01-06 1:08 ` Su Hui
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=Z3JTFJgbzX4XGHwG@mev-dev.igk.intel.com \
--to=michal.swiatkowski@linux.intel.com \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mohsin.bashr@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sanmanpradhan@meta.com \
--cc=suhui@nfschina.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).