lkml.org 
[lkml]   [2014]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ipc: constify ipc_ops
On Mon, 31 Mar 2014 07:12:36 -0700 Davidlohr Bueso <davidlohr@hp.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.


\
 
 \ /
  Last update: 2014-04-01 00:41    [W:0.916 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site