]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crash_dump: remove redundant less-than-zero check
authorThorsten Blum <thorsten.blum@linux.dev>
Sat, 28 Feb 2026 08:51:36 +0000 (09:51 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 28 Mar 2026 04:19:35 +0000 (21:19 -0700)
'key_count' is an 'unsigned int' and cannot be less than zero. Remove
the redundant condition.

Link: https://lkml.kernel.org/r/20260228085136.861971-2-thorsten.blum@linux.dev
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Baoquan He <bhe@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/crash_dump_dm_crypt.c

index a20d4097744aeeaddfcf7b378ea8bfe6d4064ded..5ce958d069dd3ea52dcc19d45994bf0f82e0fcd6 100644 (file)
@@ -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;
        }