public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@hammerspace.com>
To: "dwysocha@redhat.com" <dwysocha@redhat.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"anna.schumaker@netapp.com" <anna.schumaker@netapp.com>
Subject: Re: [PATCH v2 1/2] SUNRPC: Move simple_get_bytes and simple_get_netobj into xdr.h
Date: Thu, 21 Jan 2021 18:01:28 +0000	[thread overview]
Message-ID: <168df2212fee0592976bc1c6d509d8eeffb477a2.camel@hammerspace.com> (raw)
In-Reply-To: <CALF+zOmNZPNam11aX_qf1q_1gG1ZcHam_uPriURXydbWJAe0Fw@mail.gmail.com>

On Thu, 2021-01-21 at 12:23 -0500, David Wysochanski wrote:
> On Thu, Jan 21, 2021 at 12:05 PM Trond Myklebust
> <trondmy@hammerspace.com> wrote:
> > 
> > On Thu, 2021-01-21 at 11:20 -0500, Dave Wysochanski wrote:
> > > Remove duplicated helper functions to parse opaque XDR objects
> > > and place inside the xdr.h file.  Also update comment which
> > > is wrong since lockd is not the only user of xdr_netobj.
> > > 
> > > Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
> > > ---
> > >  include/linux/sunrpc/xdr.h          | 33
> > > +++++++++++++++++++++++++++++++--
> > >  net/sunrpc/auth_gss/auth_gss.c      | 29 -----------------------
> > > ----
> > > --
> > >  net/sunrpc/auth_gss/gss_krb5_mech.c | 29 -----------------------
> > > ----
> > > --
> > >  3 files changed, 31 insertions(+), 60 deletions(-)
> > > 
> > > diff --git a/include/linux/sunrpc/xdr.h
> > > b/include/linux/sunrpc/xdr.h
> > > index 19b6dea27367..8ef788ff80b9 100644
> > > --- a/include/linux/sunrpc/xdr.h
> > > +++ b/include/linux/sunrpc/xdr.h
> > > @@ -25,8 +25,7 @@
> > >  #define XDR_QUADLEN(l)         (((l) + 3) >> 2)
> > > 
> > >  /*
> > > - * Generic opaque `network object.' At the kernel level, this
> > > type
> > > - * is used only by lockd.
> > > + * Generic opaque `network object.'
> > >   */
> > >  #define XDR_MAX_NETOBJ         1024
> > >  struct xdr_netobj {
> > > @@ -34,6 +33,36 @@ struct xdr_netobj {
> > >         u8 *                    data;
> > >  };
> > > 
> > > +static inline const void *
> > > +simple_get_bytes(const void *p, const void *end, void *res,
> > > size_t
> > > len)
> > > +{
> > > +       const void *q = (const void *)((const char *)p + len);
> > > +       if (unlikely(q > end || q < p))
> > > +               return ERR_PTR(-EFAULT);
> > > +       memcpy(res, p, len);
> > > +       return q;
> > > +}
> > > +
> > > +static inline const void *
> > > +simple_get_netobj(const void *p, const void *end, struct
> > > xdr_netobj
> > > *dest)
> > > +{
> > > +       const void *q;
> > > +       unsigned int len;
> > > +
> > > +       p = simple_get_bytes(p, end, &len, sizeof(len));
> > > +       if (IS_ERR(p))
> > > +               return p;
> > > +       q = (const void *)((const char *)p + len);
> > > +       if (unlikely(q > end || q < p))
> > > +               return ERR_PTR(-EFAULT);
> > > +       dest->data = kmemdup(p, len, GFP_NOFS);
> > > +       if (unlikely(dest->data == NULL))
> > > +               return ERR_PTR(-ENOMEM);
> > > +       dest->len = len;
> > > +       return q;
> > > +}
> > > +
> > 
> > Hmm... I'm not too keen on having these in sunrpc/xdr.h. For one
> > thing,
> > they do not describe objects that are XDR encoded. Secondly, their
> > naming isn't really consistent with any of the existing conventions
> > for
> > xdr.
> > 
> > Can we please rather just create a new header file that is private
> > in
> > net/sunrpc/auth_gss/ ?
> > 
> 
> Sure.  Do you have any preference for the name?
> internal.h
> auth_gss.h
> something else...
> 

It is unfortunate that we already have an auth_gss.h in
include/linux/sunrpc. How about auth_gss_internal.h instead?

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



  reply	other threads:[~2021-01-21 18:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 16:20 [PATCH v2 0/2] Fix crash in trace_rpcgss_context due to 0-length acceptor Dave Wysochanski
2021-01-21 16:20 ` [PATCH v2 1/2] SUNRPC: Move simple_get_bytes and simple_get_netobj into xdr.h Dave Wysochanski
2021-01-21 17:05   ` Trond Myklebust
2021-01-21 17:23     ` David Wysochanski
2021-01-21 18:01       ` Trond Myklebust [this message]
2021-01-21 16:20 ` [PATCH v2 2/2] SUNRPC: Handle 0 length opaque XDR object data properly Dave Wysochanski
2021-01-21 18:19   ` J. Bruce Fields

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=168df2212fee0592976bc1c6d509d8eeffb477a2.camel@hammerspace.com \
    --to=trondmy@hammerspace.com \
    --cc=anna.schumaker@netapp.com \
    --cc=dwysocha@redhat.com \
    --cc=linux-nfs@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