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: <20220217025711.9369-5-dsahern@kernel.org>
Date:   Wed, 16 Feb 2022 19:57:11 -0700
From:   David Ahern <dsahern@...nel.org>
To:     netdev@...r.kernel.org
Cc:     stephen@...workplumber.org, parav@...dia.com, jiri@...dia.com,
        David Ahern <dsahern@...nel.org>
Subject: [PATCH iproute2-next 4/4] devlink: Remove strtouint8_t in favor of get_u8

strtouint8_t duplicates get_u8; remove it.

Signed-off-by: David Ahern <dsahern@...nel.org>
---
 devlink/devlink.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 54570df94b7f..da9f97788bcf 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -857,20 +857,6 @@ static int ifname_map_rev_lookup(struct dl *dl, const char *bus_name,
 	return -ENOENT;
 }
 
-static int strtouint8_t(const char *str, uint8_t *p_val)
-{
-	char *endptr;
-	unsigned long int val;
-
-	val = strtoul(str, &endptr, 10);
-	if (endptr == str || *endptr != '\0')
-		return -EINVAL;
-	if (val > UCHAR_MAX)
-		return -ERANGE;
-	*p_val = val;
-	return 0;
-}
-
 static int strtobool(const char *str, bool *p_val)
 {
 	bool val;
@@ -3123,7 +3109,7 @@ static int cmd_dev_param_set(struct dl *dl)
 						      &val_u32);
 			val_u8 = val_u32;
 		} else {
-			err = strtouint8_t(dl->opts.param_value, &val_u8);
+			err = get_u8(&val_u8, dl->opts.param_value, 10);
 		}
 		if (err)
 			goto err_param_value_parse;
@@ -4385,7 +4371,7 @@ static int cmd_port_param_set(struct dl *dl)
 						      &val_u32);
 			val_u8 = val_u32;
 		} else {
-			err = strtouint8_t(dl->opts.param_value, &val_u8);
+			err = get_u8(&val_u8, dl->opts.param_value, 10);
 		}
 		if (err)
 			goto err_param_value_parse;
-- 
2.24.3 (Apple Git-128)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ