[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z3JTFJgbzX4XGHwG@mev-dev.igk.intel.com>
Date: Mon, 30 Dec 2024 09:00:20 +0100
From: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
To: Su Hui <suhui@...china.com>
Cc: alexanderduyck@...com, kuba@...nel.org, kernel-team@...a.com,
andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, horms@...nel.org, mohsin.bashr@...il.com,
sanmanpradhan@...a.com, kalesh-anakkur.purayil@...adcom.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH v2] eth: fbnic: Avoid garbage value in
fbnic_mac_get_sensor_asic()
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@...china.com>
> Suggested-by: Jakub Kicinski <kuba@...nel.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@...ux.intel.com>
> }
>
> static const struct fbnic_mac fbnic_mac_asic = {
> --
> 2.30.2
Powered by blists - more mailing lists