[PATCH v3 03/57] locking: Introduce __cleanup() based infrastructure
Bartosz Golaszewski
brgl at bgdev.pl
Mon Aug 14 07:24:44 UTC 2023
On Mon, Jun 12, 2023 at 11:56 AM Peter Zijlstra <peterz at infradead.org> wrote:
>
[snip]
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -17,6 +17,7 @@
> #include <linux/types.h>
> #include <linux/workqueue.h>
> #include <linux/percpu-refcount.h>
> +#include <linux/cleanup.h>
>
>
> /*
> @@ -211,6 +212,8 @@ 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))
> +
Peter,
Yuri Norov pointed out to me (under a different cleanup patch) that
kfree() handles NULL-pointers and there's no reason to check it again
in DEFINE_FREE() macros. It seems right to me but I wanted to run it
by you and check if there is maybe some reason I'm not seeing to doing
it?
Bartosz
[snip]
More information about the Linux-security-module-archive
mailing list