2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-29 15:43:59 +08:00

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

Check if battery thresholds are within 0 and 100.

Fixes: 355a070b09 ("platform/x86: huawei-wmi: Add battery charging thresholds")
Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
Ayman Bagabas 2019-10-20 13:00:07 -04:00 committed by Andy Shevchenko
parent d3f5b7366a
commit 7c675486b9

View File

@ -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;