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>] [day] [month] [year] [list]
Message-Id: <20180830194814.192880-1-ebiggers@kernel.org>
Date:   Thu, 30 Aug 2018 12:48:14 -0700
From:   Eric Biggers <ebiggers@...nel.org>
To:     linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     Eric Biggers <ebiggers@...nel.org>
Subject: [PATCH] lib/parser.c: switch match_u64int() over to use match_strdup()

From: Eric Biggers <ebiggers@...gle.com>

This simplifies the code.  No change in behavior.

Signed-off-by: Eric Biggers <ebiggers@...gle.com>
---
 lib/parser.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/parser.c b/lib/parser.c
index 96656a6dd59b..dd70e5e6c9e2 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -163,13 +163,10 @@ static int match_u64int(substring_t *s, u64 *result, int base)
 	char *buf;
 	int ret;
 	u64 val;
-	size_t len = s->to - s->from;
 
-	buf = kmalloc(len + 1, GFP_KERNEL);
+	buf = match_strdup(s);
 	if (!buf)
 		return -ENOMEM;
-	memcpy(buf, s->from, len);
-	buf[len] = '\0';
 
 	ret = kstrtoull(buf, base, &val);
 	if (!ret)
-- 
2.19.0.rc0.228.g281dcd1b4d0-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ