dm-crypt: remove ineffective comparison
Subsystems (3)
PATCH 1/1 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
--- kernel/crash_dump_dm_crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/crash_dump_dm_crypt.c +1 -1
@@ -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 ; }
Signature · 1 line
2.51.0
CC Coiby,
Quoted 18 lines · Suchit Karunakaran
In
restore_dm_crypt_keys_to_thread_keyring(),key_countis a global variable declared as unsigned int. The comparisonkey_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 <[email protected]>--- kernel/crash_dump_dm_crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/crash_dump_dm_crypt.c +0
-0
kernel/crash_dump_dm_crypt.c static int restore_dm_crypt_keys_to_thread_keyring(void) · line 118
Quoted 5 lines
kernel/crash_dump_dm_crypt.c +1
-1@@ -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 ) {
Sounds reasonable to me,
Quoted 6 lines
kernel/crash_dump_dm_crypt.c +0
-0kexec_dprintk ("Failed to read the number of dm-crypt keys\n" );return -1 ; }Signature · 1 line
2.51.0