• Chuck Lever's avatar
    NFSD: Fix nfs4_verifier memory alignment · ab4684d1
    Chuck Lever authored
    Clean up due to code review.
    
    The nfs4_verifier's data field is not guaranteed to be u32-aligned.
    Casting an array of chars to a u32 * is considered generally
    hazardous.
    
    We can fix most of this by using a __be32 array to generate the
    verifier's contents and then byte-copying it into the verifier field.
    
    However, there is one spot where there is a backwards compatibility
    constraint: the do_nfsd_create() call expects a verifier which is
    32-bit aligned.  Fix this spot by forcing the alignment of the create
    verifier in the nfsd4_open args structure.
    
    Also, sizeof(nfs4_verifer) is the size of the in-core verifier data
    structure, but NFS4_VERIFIER_SIZE is the number of octets in an XDR'd
    verifier.  The two are not interchangeable, even if they happen to
    have the same value.
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    ab4684d1
xdr4.h 18.3 KB