netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: David Miller <davem@davemloft.net>
Cc: tixxdz@opendz.org, ebiederm@xmission.com,
	viro@zeniv.linux.org.uk, netdev@vger.kernel.org
Subject: Re: [PATCH] net: reference the ipv4 sysctl table header
Date: Wed, 28 Mar 2012 12:32:20 -0400	[thread overview]
Message-ID: <20120328163219.GA19778@home.goodmis.org> (raw)
In-Reply-To: <20120326.182411.41401140080225401.davem@davemloft.net>

On Mon, Mar 26, 2012 at 06:24:11PM -0400, David Miller wrote:
> From: Djalal Harouni <tixxdz@opendz.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

  parent reply	other threads:[~2012-03-28 16:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26 22:23 [PATCH] net: reference the ipv4 sysctl table header Djalal Harouni
2012-03-26 22:24 ` David Miller
2012-03-26 22:42   ` Djalal Harouni
2012-03-28 16:32   ` Steven Rostedt [this message]
2012-03-28 20:51     ` David Miller
2012-03-31 14:29       ` Djalal Harouni
2012-03-26 22:50 ` Eric W. Biederman
2012-03-26 23:21   ` Djalal Harouni
2012-03-28  2:35     ` Eric W. Biederman
2012-03-31 14:25       ` Djalal Harouni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120328163219.GA19778@home.goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=netdev@vger.kernel.org \
    --cc=tixxdz@opendz.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).