[PATCH] dm: crash dump: remove redundant NULL check before kvfree()
mdshahid03 at gmail.com
mdshahid03 at gmail.com
Fri Jul 3 04:26:42 PDT 2026
From: Mohammad Shahid <mdshahid03 at gmail.com>
kvfree() safely handles NULL pointers, so the explicit NULL check
before calling kvfree() is unnecessary.
This issue was reported by ifnullfree.cocci.
Signed-off-by: Mohammad Shahid <mdshahid03 at gmail.com>
---
kernel/crash_dump_dm_crypt.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/crash_dump_dm_crypt.c b/kernel/crash_dump_dm_crypt.c
index cb875ddb6ba6..cf4d41fd4d5e 100644
--- a/kernel/crash_dump_dm_crypt.c
+++ b/kernel/crash_dump_dm_crypt.c
@@ -364,8 +364,7 @@ static int build_keys_header(void)
struct config_key *key;
int i, r;
- if (keys_header != NULL)
- kvfree(keys_header);
+ kvfree(keys_header);
keys_header = kzalloc(get_keys_header_size(key_count), GFP_KERNEL);
if (!keys_header)
--
2.43.0
More information about the kexec
mailing list