git: cc33771bf771 - main - ctld: Use expand_unsigned for parsing unsigned NVMe option values
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 15:45:18 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=cc33771bf77102291db1e50037a07c1501a24075
commit cc33771bf77102291db1e50037a07c1501a24075
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-11-12 15:44:18 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-11-12 15:44:18 +0000
ctld: Use expand_unsigned for parsing unsigned NVMe option values
Sponsored by: Chelsio Communications
---
usr.sbin/ctld/nvmf.cc | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/usr.sbin/ctld/nvmf.cc b/usr.sbin/ctld/nvmf.cc
index 689c3404af1a..9940722420e3 100644
--- a/usr.sbin/ctld/nvmf.cc
+++ b/usr.sbin/ctld/nvmf.cc
@@ -124,15 +124,14 @@ parse_number(const nvlist_t *nvl, const char *key, uint64_t def, uint64_t minv,
uint64_t maxv)
{
const char *value;
- int64_t val;
+ uint64_t val;
if (!nvlist_exists_string(nvl, key))
return def;
value = nvlist_get_string(nvl, key);
- if (expand_number(value, &val) == 0 && val >= 0 &&
- (uint64_t)val >= minv && (uint64_t)val <= maxv)
- return (uint64_t)val;
+ if (expand_unsigned(value, &val) == 0 && val >= minv && val <= maxv)
+ return val;
log_warnx("Invalid value \"%s\" for numeric option %s", value, key);
return def;