dm: crash dump: remove redundant NULL check before kvfree()
Subsystems (3)
PATCH 1/1 dm: crash dump: remove redundant NULL check before kvfree()
From: Mohammad Shahid <[email protected]>
kvfree() safely handles NULL pointers, so the explicit NULL check before calling kvfree() is unnecessary.
This issue was reported by ifnullfree.cocci.
--- kernel/crash_dump_dm_crypt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/crash_dump_dm_crypt.c +1 -2
@@ -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)
Signature · 1 line
2.43.0
Quoted 8 lines · On Fri, Jul 03 2026, [email protected] wrote:
From: Mohammad Shahid <[email protected]>
kvfree()safely handles NULL pointers, so the explicit NULL check before callingkvfree()is unnecessary.This issue was reported by
ifnullfree.cocci.Signed-off-by Mohammad Shahid <[email protected]>
BTW, Sashiko [0] pointed out a bunch of problems in the surrounding code, and they seem to look legit. If you're interested, help in fixing them would be much appreciated.
[0] https://sashiko.dev/#/patchset/[email protected]
[...]
Signature · 2 lines
Regards, Pratyush Yadav
Quoted 4 lines · Pratyush Yadav
Quoted 2 lines · On Fri, Jul 03 2026, [email protected] wrote:
From: Mohammad Shahid <[email protected]>
Quoted 8 lines
Quoted 6 lines
kvfree()safely handles NULL pointers, so the explicit NULL check before callingkvfree()is unnecessary.This issue was reported by
ifnullfree.cocci.Signed-off-by Mohammad Shahid <[email protected]>Reviewed-by Pratyush Yadav <[email protected]>
Hi Pratyush,
Thanks for reviewing this patch!
Quoted 6 lines
BTW, Sashiko [0] pointed out a bunch of problems in the surrounding code, and they seem to look legit. If you're interested, help in fixing them would be much appreciated.
I'll send a new version of
https://lore.kernel.org/kexec/[email protected]/
soon which can address Sashiko's feedback scrutinized by Sourabh.
Quoted 7 lines
[...]
Signature · 2 lines
Regards, Pratyush Yadav
Signature · 2 lines
Best regards, Coiby
Pratyush Yadav
maintainerQuoted 23 lines · Coiby Xu
Quoted 4 lines · Pratyush Yadav
Quoted 2 lines · On Fri, Jul 03 2026, [email protected] wrote:
From: Mohammad Shahid <[email protected]>
Quoted 8 lines
Quoted 6 lines
kvfree()safely handles NULL pointers, so the explicit NULL check before callingkvfree()is unnecessary.This issue was reported by
ifnullfree.cocci.Signed-off-by Mohammad Shahid <[email protected]>Reviewed-by Pratyush Yadav <[email protected]>Hi Pratyush,
Thanks for reviewing this patch!
Quoted 5 lines
BTW, Sashiko [0] pointed out a bunch of problems in the surrounding code, and they seem to look legit. If you're interested, help in fixing them would be much appreciated.
Quoted 5 lines
Quoted 1 line
I'll send a new version of
https://lore.kernel.org/kexec/[email protected]/
soon which can address Sashiko's feedback scrutinized by Sourabh.
Oh, great. Thanks!
Signature · 2 lines
Regards, Pratyush Yadav