Re: [PATCH] efivarfs: revert "fix memory leak in efivarfs_create()"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 27 Nov 2020 at 17:56, Jonathon Fernyhough <jonathon@xxxxxxx> wrote:
>
> On 25/11/2020 10:28, Ard Biesheuvel wrote:
> > On Wed, 25 Nov 2020 at 11:27, Oleksandr Natalenko
> > <oleksandr@xxxxxxxxxxxxxx> wrote:
> >>
> >> On 25.11.2020 08:53, Ard Biesheuvel wrote:
> --snip--
> >>
> >> Do we need to do this as well:
> >>
> >> #include <linux/kmemleak.h>
> >>
> >> ?
> >>
> >> Because otherwise for 5.9 I get:
> >>
> >> [  148s] fs/efivarfs/inode.c: In function 'efivarfs_create':
> >> [  148s] fs/efivarfs/inode.c:106:2: error: implicit declaration of
> >> function 'kmemleak_ignore' [-Werror=implicit-function-declaration]
> >> [  148s]   106 |  kmemleak_ignore(var);
> >> [  148s]       |  ^~~~~~~~~~~~~~~
> >>
> >
> > Ah yes, thanks for the report. I will add the include to the patch.
> >
> >
>
> Is this necessary if CONFIG_DEBUG_KMEMLEAK is not enabled in the kernel
> config? e.g. should there be an #ifdef CONFIG_DEBUG_KMEMLEAK somewhere
> in there?
>

We typically define these helpers unconditionally, and sort out the
differences in the header file. In this case, we have

static inline void kmemleak_ignore(const void *ptr)
{
}

in include/linux/kmemleak.h if CONFIG_DEBUG_KMEMLEAK is not set.

This makes the calling code much cleaner.



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux