[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20140331145929.7fc32c21c884739892c46831@linux-foundation.org>
Date: Mon, 31 Mar 2014 14:59:29 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Davidlohr Bueso <davidlohr@...com>
Cc: Mathias Krause <minipli@...glemail.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
PaX Team <pageexec@...email.hu>,
Nadia Derbey <Nadia.Derbey@...l.net>,
Manfred Spraul <manfred@...orfullife.com>
Subject: Re: [PATCH] ipc: constify ipc_ops
On Mon, 31 Mar 2014 07:12:36 -0700 Davidlohr Bueso <davidlohr@...com> wrote:
> > >> --- a/ipc/msg.c
> > >> +++ b/ipc/msg.c
> > >> @@ -306,15 +306,14 @@ static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
> > >> SYSCALL_DEFINE2(msgget, key_t, key, int, msgflg)
> > >> {
> > >> struct ipc_namespace *ns;
> > >> - struct ipc_ops msg_ops;
> > >> + static const struct ipc_ops msg_ops = {
> > >> + .getnew = newque,
> > >> + .associate = msg_security,
> > >
> > > For completeness, please add .more_checks = NULL as well.
> >
> > The C standard already ensures that .more_checks is initialized with
> > NULL. So I don't see any benefit from doing it explicitly.
> > We're not initializing global/static variables holding NULL pointers
> > in the majority of the code base either, so this is just "best
> > practice".
>
> Hence the word _completeness_.
It's unusual to fill in the zeroed fields. We could put it in
explicitly as commentary to tell the reader "this exists - we thought
about it and decided to leave it zero". Which presumably is along the
lines of what you're thinking. Or not ;)
I'm easy either way. I'll shove the patch into my nice pile of
things-to-look-at-after-rc1.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists