Re: [PATCH] nfsd: sparse endianness warning cleanups

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

 



On Tue, 17 Jun 2014 03:28:12 -0700
Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

> > @@ -581,8 +581,8 @@ static void gen_boot_verifier(nfs4_verifier *verifier, struct net *net)
> >  	__be32 verf[2];
> >  	struct nfsd_net *nn = net_generic(net, nfsd_net_id);
> >  
> > -	verf[0] = (__be32)nn->nfssvc_boot.tv_sec;
> > -	verf[1] = (__be32)nn->nfssvc_boot.tv_usec;
> > +	verf[0] = (__force __be32)nn->nfssvc_boot.tv_sec;
> > +	verf[1] = (__force __be32)nn->nfssvc_boot.tv_usec;
> >  	memcpy(verifier->data, verf, sizeof(verifier->data));
> 
> Given that the verifier should be opaque is there any reason not to
> simple do the byte swap here?  If not I think the rule that no __force
> cast should be without a comment applies here.
> 

The only real reason would be efficiency. Since it's opaque, doing a
byte swap doesn't really buy us anything.

> > -	verf[0] = (__be32)get_seconds();
> > -	verf[1] = (__be32)i++;
> > +	verf[0] = (__force __be32)get_seconds();
> > +	verf[1] = (__force __be32)i++;
> >  	memcpy(clp->cl_confirm.data, verf,
> > sizeof(clp->cl_confirm.data));
> 
> Same here.
> 
> In general I think one patch per issue also would better, and some
> comments of what's fixed (trivial for the places adding static, not so
> trivial for various __force overrides)

Fair enough. I'll break this up some and resend.

-- 
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