Skip to content

Commit 4444e14

Browse files
Su HuiNipaLocal
authored andcommitted
eth: fbnic: Avoid garbage value in fbnic_mac_get_sensor_asic()
'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: d85ebad ("eth: fbnic: Add hardware monitoring support via HWMON interface") Signed-off-by: Su Hui <[email protected]> Suggested-by: Jakub Kicinski <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent aee4daa commit 4444e14

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

drivers/net/ethernet/meta/fbnic/fbnic_mac.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -688,23 +688,7 @@ fbnic_mac_get_eth_mac_stats(struct fbnic_dev *fbd, bool reset,
688688

689689
static int fbnic_mac_get_sensor_asic(struct fbnic_dev *fbd, int id, long *val)
690690
{
691-
struct fbnic_fw_completion fw_cmpl;
692-
s32 *sensor;
693-
694-
switch (id) {
695-
case FBNIC_SENSOR_TEMP:
696-
sensor = &fw_cmpl.tsene.millidegrees;
697-
break;
698-
case FBNIC_SENSOR_VOLTAGE:
699-
sensor = &fw_cmpl.tsene.millivolts;
700-
break;
701-
default:
702-
return -EINVAL;
703-
}
704-
705-
*val = *sensor;
706-
707-
return 0;
691+
return -EOPNOTSUPP;
708692
}
709693

710694
static const struct fbnic_mac fbnic_mac_asic = {

0 commit comments

Comments
 (0)