slab: drop unneeded NULL-pointer check in kfree auto cleanup
Subsystems (2)
PATCH 1/1 slab: drop unneeded NULL-pointer check in kfree auto cleanup
From: Bartosz Golaszewski <[email protected]>
kfree() already accepts and silently ignores NULL-pointers, there's no need to check it when running the auto cleanup routine.
--- include/linux/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/slab.h +1 -1
@@ -228,7 +228,7 @@ void kfree(const void *objp);void kfree_sensitive (const void *objp);size_t __ksize (const void *objp); -DEFINE_FREE(kfree, void *, if (_T) kfree(_T)) +DEFINE_FREE(kfree, void *, kfree(_T))/** * ksize - Report actual allocation size of associated object
Signature · 1 line
2.39.2
Quoted 4 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
kfree()already accepts and silently ignores NULL-pointers, there's no need to check it when running the auto cleanup routine.
There is, because now the compiler can't help you anymore. Also see:
https://lkml.kernel.org/r/169451499208.27769.5856056754166699857.tip-bot2@tip-bot2
Quoted 10 lines · Peter Zijlstra
Quoted 4 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
kfree()already accepts and silently ignores NULL-pointers, there's no need to check it when running the auto cleanup routine.There is, because now the compiler can't help you anymore. Also see:
https://lkml.kernel.org/r/169451499208.27769.5856056754166699857.tip-bot2@tip-bot2
Makes sense, thanks!
Bart