netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Fabian Frederick <fabf@skynet.be>,
	Guenter Roeck <linux@roeck-us.net>,
	David Miller <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1 net-next] af_unix: remove NULL assignment on static
Date: Wed, 08 Oct 2014 11:34:10 +0200	[thread overview]
Message-ID: <1412760850.7228.5.camel@localhost> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D174C6CA5@AcuExch.aculab.com>

On Mi, 2014-10-08 at 09:10 +0000, David Laight wrote:
> From: Hannes Frederic Sowa
> > I think David's concern was whether if 0 == false in all situations. It
> > is pretty clear that static memory is initialized to 0.
> 
> I'm not 100% sure about that.
> static pointers may be required to be initialised to NULL.

This isn't something the C standard specified but in case of Linux, I
think the ELF standard might be the right one to look at. Looking at the
kernel, I think this is an unwritten law. ;)

The standard allows NULL and static memory initialization to be
implementation defined, so NULL very well might not be 'all 0', that's
correct. Even static memory must only be initialized, when this happens
and how it is initialized is completely up to the implementation.

> If NULL isn't the 'all 0 bit pattern' then the memory would need
> to be initialised to a different pattern.

I haven't looked closely but I don't think that pointers need to be
initialized to NULL, but please don't quote me on this.

> Not that anyone is likely to implement such a system because far too
> much code will break.
> 
> The only system I knew where 'native' NULL pointers were 'all 1s'
> used 0 in its C compiler.

:)

Bye,
Hannes

  reply	other threads:[~2014-10-08  9:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07 20:16 [PATCH 1/1 net-next] af_unix: remove NULL assignment on static Fabian Frederick
2014-10-07 20:18 ` David Miller
2014-10-07 20:26   ` Hannes Frederic Sowa
2014-10-07 20:33   ` Guenter Roeck
2014-10-07 20:49     ` Fabian Frederick
2014-10-07 20:50       ` David Miller
2014-10-07 20:54       ` Hannes Frederic Sowa
2014-10-07 21:05         ` Fabian Frederick
2014-10-08  9:10         ` David Laight
2014-10-08  9:34           ` Hannes Frederic Sowa [this message]
2014-10-08  9:46           ` Michal Kubecek

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=1412760850.7228.5.camel@localhost \
    --to=hannes@stressinduktion.org \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=netdev@vger.kernel.org \
    /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).