Commit 7c675486 authored by Ayman Bagabas's avatar Ayman Bagabas Committed by Andy Shevchenko

platform/x86: huawei-wmi: Stricter battery thresholds set

Check if battery thresholds are within 0 and 100.

Fixes: 355a070b ("platform/x86: huawei-wmi: Add battery charging thresholds")
Signed-off-by: default avatarAyman Bagabas <ayman.bagabas@gmail.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent d3f5b736
......@@ -345,7 +345,7 @@ static int huawei_wmi_battery_set(int start, int end)
union hwmi_arg arg;
int err;
if (start < 0 || end > 100)
if (start < 0 || end < 0 || start > 100 || end > 100)
return -EINVAL;
arg.cmd = BATTERY_THRESH_SET;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment