git: 25024d96492e - main - sbin/nvmecontrol: fix signedness comparison warning
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 28 Oct 2026 13:19:53 UTC
The branch main has been updated by siva:
URL: https://cgit.FreeBSD.org/src/commit/?id=25024d96492e51c250789d16de5064d4c00c7a86
commit 25024d96492e51c250789d16de5064d4c00c7a86
Author: Siva Mahadevan <siva@FreeBSD.org>
AuthorDate: 2026-10-27 20:51:39 +0000
Commit: Siva Mahadevan <siva@FreeBSD.org>
CommitDate: 2026-10-28 13:18:47 +0000
sbin/nvmecontrol: fix signedness comparison warning
sector_size is guaranteed to be non-zero here, so cast to
uint32_t to match the comparison.
This fixes the [gcc14 build in CI][0]:
/workspace/src/sbin/nvmecontrol/format.c: In function 'find_lbaf':
/workspace/src/sbin/nvmecontrol/format.c:132:60: error: comparison of integer expressions of different signedness: 'uint32_t' {aka 'unsigned int'} and 'int' [-Werror=sign-compare]
132 | if (NVMEV(NVME_NS_DATA_LBAF_LBADS, format) != lbads ||
| ^~
[0] https://ci.freebsd.org/job/FreeBSD-main-amd64-gcc14_build/5051/
Reviewed by: imp
Fixes: b991e2dd824c ("nvmecontrol: support controller-wide sector sizes")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
---
sbin/nvmecontrol/format.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sbin/nvmecontrol/format.c b/sbin/nvmecontrol/format.c
index 71e557910654..2efc0144c232 100644
--- a/sbin/nvmecontrol/format.c
+++ b/sbin/nvmecontrol/format.c
@@ -120,10 +120,10 @@ static int
find_lbaf(const struct nvme_namespace_data *nsd, uint32_t sector_size,
bool require_unique)
{
- uint32_t format;
- int best, best_rp, i, lbads, matches, rp;
+ uint32_t format, lbads;
+ int best, best_rp, i, matches, rp;
- lbads = fls(sector_size) - 1;
+ lbads = (uint32_t)fls(sector_size) - 1;
best = -1;
best_rp = 4;
matches = 0;