From patchwork Fri Oct 18 22:42:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayman Bagabas X-Patchwork-Id: 11199817 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E3581951 for ; Fri, 18 Oct 2019 22:42:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2241020679 for ; Fri, 18 Oct 2019 22:42:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="axy9avYM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727867AbfJRWmd (ORCPT ); Fri, 18 Oct 2019 18:42:33 -0400 Received: from mail-yb1-f182.google.com ([209.85.219.182]:42464 "EHLO mail-yb1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726827AbfJRWmd (ORCPT ); Fri, 18 Oct 2019 18:42:33 -0400 Received: by mail-yb1-f182.google.com with SMTP id 4so2298831ybq.9; Fri, 18 Oct 2019 15:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=3zrsI5rFL6aWl8+FvhNVZd4YBmAJUYa6PdGTurxD/7o=; b=axy9avYMDMNr51+VyGcyNhHilqglIkhIqEfInbqrI+Y1d5KFx8GRBEVZ/Z2tLf02Pn xBgyNC2jrZULg/somCXRbBL9Ys5c+FRhU6ecpg+99o19dgH9D8UZ9rJ3dSk/9TWFOBbs SQWmQqiNsxaFlccnnaf4p+G+TtqpM9zyqBhFSKdAkuMID3JDQ3QeIIv9AGkDXvByGN2l TLUukDdAgz7qdch5LiKU2eKNPj08jNeekntSZAmPF5rUjTuvFuEhSBPsFNun4CoPOYKy wv9uuQ9N7Hb6g2H3bcevNB3lJjQz88FzJ+FP34qWfDWneqLMi+E4MsAbuhqFy4GjgzEL UX0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=3zrsI5rFL6aWl8+FvhNVZd4YBmAJUYa6PdGTurxD/7o=; b=r6V9RFPeigh2Plc87INtYNR9ocEk7VY+c89HmxHe0NbMiZ/alBHvQBYSRHQiBe+Ffm 7pXsak6gkFPMXQjhEENB18Ak48ge7rgoDJsocXcERMFcqqq3MZhijn04bWaCGBDrSJlL mACjdFc06/+6S076Kin0MzoPDouacq7B+8dmNYgS0iSfL62/kROPh4gTo5m0CIgoy9PS 8hXBIg8TobPB5teF9ATbLs7pJHmNEF6qR+KYj7hrVw0SQwDJYz07b1Hn6ABmAOjGPtT0 JehCA1xbpjKCyXaqN8NE32zM+Cwemf9skPcbLh7PtCqgJ9P+/hmL7/D4YNina6hhpn0R az/A== X-Gm-Message-State: APjAAAWlb8ozwyFA/npUXwfORhHRHIXLmmzJ3YzWacCFD8GCaYtj994A pDvqS5bMiiVZyNT//degrQ== X-Google-Smtp-Source: APXvYqw5DvbASEeHlQBZa248ii+jELoiVL2K94crkEBUhLUR/acf3+6rbM525u+o61cM6SDqccnWpQ== X-Received: by 2002:a25:13c1:: with SMTP id 184mr8369705ybt.20.1571438552294; Fri, 18 Oct 2019 15:42:32 -0700 (PDT) Received: from 960.localdomain ([64.192.53.12]) by smtp.gmail.com with ESMTPSA id d188sm1645412ywa.88.2019.10.18.15.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 15:42:31 -0700 (PDT) From: Ayman Bagabas To: Darren Hart , Andy Shevchenko , Ayman Bagabas , Mattias Jacobsson <2pi@mok.nu>, Takashi Iwai , Dan Carpenter , kbuild test robot , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] platform/x86: huawei-wmi: Stricter battery thresholds set Date: Fri, 18 Oct 2019 18:42:13 -0400 Message-Id: <20191018224221.15495-1-ayman.bagabas@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Check if battery thresholds are within 0 and 100. Signed-off-by: Ayman Bagabas --- drivers/platform/x86/huawei-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: fd13c8622a5ad4f7317b64de4f6aa2de1962220e diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c index 5837d1b8693d..26041d44286a 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;