[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120328163219.GA19778@home.goodmis.org>
Date: Wed, 28 Mar 2012 12:32:20 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: David Miller <davem@...emloft.net>
Cc: tixxdz@...ndz.org, ebiederm@...ssion.com, viro@...iv.linux.org.uk,
netdev@...r.kernel.org
Subject: Re: [PATCH] net: reference the ipv4 sysctl table header
On Mon, Mar 26, 2012 at 06:24:11PM -0400, David Miller wrote:
> From: Djalal Harouni <tixxdz@...ndz.org>
> Date: Mon, 26 Mar 2012 23:23:59 +0100
>
> > +static struct ctl_table_header *ip4_base;
> > +
> > /*
> > * We really need to sanitize the damn ipv4 init order, then all
> > * this nonsense will go away.
> > */
> > -void __init ip_static_sysctl_init(void)
> > +int __init ip_static_sysctl_init(void)
> > {
> > - register_sysctl_paths(ipv4_path, ipv4_skeleton);
> > + ip4_base = register_sysctl_paths(ipv4_path, ipv4_skeleton);
>
> This is so incredibly stupid, just panic() or similar if this
> returns NULL.
>
> And find another way to annotate this for memleak so we don't need to
> waste an entire pointer, which is never used, in the data section.
I just started using kmemleak and notice that it reports false positives
for several __init functions that call register_sysctl_paths(). The fix
you want is:
{
sturct ctl_table_header *head;
head = register_sysctl_paths(ipv4_path, ipv4_skeleton);
BUG_ON(!head);
kmemleak_ignore(head);
No need to waste a pointer just to keep the reference around for
kmemleak.
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists