Re: [PATCH 3/7] sunrpc: clean up endianness warnings in setup_token

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 15 Jul 2014 10:08:06 -0700
Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

> On Sun, Jul 13, 2014 at 09:57:40PM -0400, Jeff Layton wrote:
> > This is safe since KG_TOK_MIC_MSG and SEAL_ALG_NONE are both endian
> > palindromes. I'm also making the assumption that the signalg field
> > really should be in little-endian. That looks odd, but looking at the
> > spec I guess it's correct.
> 
> > @@ -83,10 +83,10 @@ setup_token(struct krb5_ctx *ctx, struct xdr_netobj *token)
> >  
> >  	/* ptr now at start of header described in rfc 1964, section 1.2.1: */
> >  	krb5_hdr = ptr;
> > +	*ptr++ = cpu_to_be16(KG_TOK_MIC_MSG);
> > +	*ptr++ = (__force __be16)cpu_to_le16(ctx->gk5e->signalg);
> > +	*ptr++ = cpu_to_be16(SEAL_ALG_NONE);
> > +	*ptr++ = cpu_to_be16(0xffff);
> 
> If signalg is little endian and all others are palindromes it seems
> like ptr should be defines as __le16.
> 

The spec doesn't really define it as little-endian. It's just an opaque series of bytes that happens to be a little-endian representation of 


> >  	return (char *)krb5_hdr;
> 
> Seems like krb5_hdr should simply be defined as void *, together with
> the return value?
> 

Yeah, that may make more sense.

-- 
Jeff Layton <jlayton@xxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux