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

Samasth Norway Ananda posted 1 patch 3 weeks, 4 days ago
security/landlock/id.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] landlock: Fix unsigned comparison in get_id_range()
Posted by Samasth Norway Ananda 3 weeks, 4 days ago
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@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