Skip to content

Commit 5598657

Browse files
committed
drivers/mge-hid.c: eaton_input_eco_mode_check_range(): sanity-check that value==1 [#2956]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 603a74f commit 5598657

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/mge-hid.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,11 @@ static const char *eaton_input_eco_mode_check_range(double value)
915915
const char *frequency_range_transfer_str = dstate_getinfo("input.transfer.frequency.eco.range");
916916
const char *bypass_frequency_str = dstate_getinfo("input.bypass.frequency");
917917

918-
NUT_UNUSED_VARIABLE(value);
918+
if ((int)value != 1) {
919+
upsdebugx(1, "%s: wrong 'value' parameter '%f' for this method, should be '1'",
920+
__func__, value);
921+
return NULL;
922+
}
919923

920924
errno = 0;
921925
if (bypass_voltage_str == NULL || bypass_frequency_str == NULL

0 commit comments

Comments
 (0)