From: Yunseong Kim <[email protected]>
This patch fix compiler warning in kmod_dump_index()
libkmod/libkmod.c:989:11: warning: result of comparison of unsigned enum
expression < 0 is always false [-Wtautological-unsigned-enum-zero-compare]
989 | if (type < 0 || type >= _KMOD_INDEX_MODULES_SIZE)
| ~~~~ ^ ~
My compiler version.
$ clang -v
clang version 18.1.6 (Fedora 18.1.6-3.fc40)
Signed-off-by: Yunseong Kim <[email protected]>
---
libkmod/libkmod.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 213b424..fcb619b 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -986,7 +986,7 @@ KMOD_EXPORT int kmod_dump_index(struct kmod_ctx *ctx, enum
kmod_index type,
if (ctx == NULL)
return -ENOSYS;
- if (type < 0 || type >= _KMOD_INDEX_MODULES_SIZE)
+ if (type >= KMOD_INDEX_MODULES_DEP || type >= _KMOD_INDEX_MODULES_SIZE)
return -ENOENT;
if (ctx->indexes[type] != NULL) {
--
2.45.2