lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190221183826.GA30993@kadam>
Date:   Thu, 21 Feb 2019 21:38:26 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Andrew Morton <akpm@...ux-foundation.org>,
        "Luis R. Rodriguez" <mcgrof@...nel.org>
Cc:     Randy Dunlap <rdunlap@...radead.org>, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH 2/2] test_firmware: silence underflow warning in
 test_dev_config_update_u8()

We put an upper bound on "new" but we don't check for negatives. In
this case the underflow doesn't matter very much, but we may as well
make the static checker happy.

Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
 lib/test_firmware.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index 7222093ee00b..5911b0f1a715 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -326,15 +326,12 @@ static ssize_t test_dev_config_show_int(char *buf, int cfg)
 static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg)
 {
 	int ret;
-	long new;
+	u8 new;
 
-	ret = kstrtol(buf, 10, &new);
+	ret = kstrtou8(buf, 10, &new);
 	if (ret)
 		return ret;
 
-	if (new > U8_MAX)
-		return -EINVAL;
-
 	mutex_lock(&test_fw_mutex);
 	*(u8 *)cfg = new;
 	mutex_unlock(&test_fw_mutex);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ