X86 platform drivers
 help / color / mirror / Atom feed
From: Ayman Bagabas <ayman.bagabas@gmail.com>
To: Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	Ayman Bagabas <ayman.bagabas@gmail.com>,
	Mattias Jacobsson <2pi@mok.nu>, Takashi Iwai <tiwai@suse.de>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	kbuild test robot <lkp@intel.com>,
	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	[thread overview]
Message-ID: <20191018224221.15495-1-ayman.bagabas@gmail.com> (raw)

Check if battery thresholds are within 0 and 100.
---
 drivers/platform/x86/huawei-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;

base-commit: fd13c8622a5ad4f7317b64de4f6aa2de1962220e
-- 
2.21.0

             reply	other threads:[~2019-10-18 22:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18 22:42 Ayman Bagabas [this message]
2019-10-18 22:42 ` [PATCH 2/2] platform/x86: huawei-wmi: No need to check for battery name Ayman Bagabas
2019-10-20  0:33   ` ayman.bagabas
2019-10-19  8:31 ` [PATCH 1/2] platform/x86: huawei-wmi: Stricter battery thresholds set Dan Carpenter
2019-10-20  0:32   ` ayman.bagabas
2019-10-20  7:55     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191018224221.15495-1-ayman.bagabas@gmail.com \
    --to=ayman.bagabas@gmail.com \
    --cc=2pi@mok.nu \
    --cc=andy@infradead.org \
    --cc=dan.carpenter@oracle.com \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox