[PATCH] landlock: Fix unsigned comparison in get_id_range()

Samasth Norway Ananda samasth.norway.ananda at oracle.com
Tue Jan 13 06:36:10 UTC 2026


Fix unsigned comparison where size_t variable is compared with '<= 0'.
Change to '== 0' to match the actual intent.

Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda at oracle.com>
---
 security/landlock/id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/landlock/id.c b/security/landlock/id.c
index 838c3ed7bb82..5424cb3d7ee3 100644
--- a/security/landlock/id.c
+++ b/security/landlock/id.c
@@ -96,7 +96,7 @@ static u64 get_id_range(size_t number_of_ids, atomic64_t *const counter,
 	 * We should return at least 1 ID, and we may need a set of consecutive
 	 * ones (e.g. to generate a set of inodes).
 	 */
-	if (WARN_ON_ONCE(number_of_ids <= 0))
+	if (WARN_ON_ONCE(number_of_ids == 0))
 		number_of_ids = 1;
 
 	/*
-- 
2.50.1




More information about the Linux-security-module-archive mailing list