[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251001120254.24980-1-suchitkarunakaran@gmail.com>
Date: Wed, 1 Oct 2025 17:32:54 +0530
From: Suchit Karunakaran <suchitkarunakaran@...il.com>
To: akpm@...ux-foundation.org,
bhe@...hat.com,
vgoyal@...hat.com,
dyoung@...hat.com,
kexec@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org,
skhan@...uxfoundation.org,
Suchit Karunakaran <suchitkarunakaran@...il.com>
Subject: [PATCH] dm-crypt: remove ineffective comparison
In restore_dm_crypt_keys_to_thread_keyring(), key_count is a global
variable declared as unsigned int. The comparison key_count < 0
is therefore always false and has no effect.
Remove the dead comparison to make the code clearer and
silence static analysis warnings.
Found by Coverity: CID#1649028
Signed-off-by: Suchit Karunakaran <suchitkarunakaran@...il.com>
---
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 401423ba477d..39cfc13ff350 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;
}
--
2.51.0
Powered by blists - more mailing lists