From: Ayman Bagabas Date: Sun, 20 Oct 2019 17:00:07 +0000 (-0400) Subject: platform/x86: huawei-wmi: Stricter battery thresholds set X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7c675486b97afea710f4c11ca71cb228c1e671be;p=linux.git platform/x86: huawei-wmi: Stricter battery thresholds set Check if battery thresholds are within 0 and 100. Fixes: 355a070b09ab ("platform/x86: huawei-wmi: Add battery charging thresholds") Signed-off-by: Ayman Bagabas Signed-off-by: Andy Shevchenko --- diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c index 5837d1b8693d1..26041d44286a9 100644 --- a/drivers/platform/x86/huawei-wmi.c +++ b/drivers/platform/x86/huawei-wmi.c @@ -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;