[PATCH] crash_dump: Remove redundant less-than-zero check

From: Thorsten Blum

Date: Sat Feb 28 2026 - 03:52:07 EST


'key_count' is an 'unsigned int' and cannot be less than zero. Remove
the redundant condition.

Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
kernel/crash_dump_dm_crypt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/crash_dump_dm_crypt.c b/kernel/crash_dump_dm_crypt.c
index 1f4067fbdb94..27a144920562 100644
--- a/kernel/crash_dump_dm_crypt.c
+++ b/kernel/crash_dump_dm_crypt.c
@@ -115,7 +115,7 @@ static int restore_dm_crypt_keys_to_thread_keyring(void)

addr = dm_crypt_keys_addr;
dm_crypt_keys_read((char *)&key_count, sizeof(key_count), &addr);
- if (key_count < 0 || key_count > KEY_NUM_MAX) {
+ if (key_count > KEY_NUM_MAX) {
kexec_dprintk("Failed to read the number of dm-crypt keys\n");
return -1;
}
--
Thorsten Blum <thorsten.blum@xxxxxxxxx>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4