Subject: Re: file id alignment
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 06/30/2006 23:47:45
>>>> -	struct tmpfs_fid *tfhp;
>>>> +	struct tmpfs_fid tfh;
>>> you need to ensure that any padding bytes in tfh are properly
>>> initialized.
>> Why?  If they're padding bytes, by definition they do not belong to
>> any of the struct fields and anything depending on them is broken.
> IIRC, these are used to form NFS file handles.  NFS clients will
> bcmp() file handles for various purposes.

Then the code for creating file handles from structs tmpfs_fid is
broken, in that it depends on padding bytes in invalid ways.

If the code neither (a) ensures there are no padding bytes nor (b)
ensures the file handles are constructed in ways that avoid including
the values of any possible padding bytes in file handles, the code is
just plain *broken*.

> It's important for the NFS server to construct and return identical
> file handles for a given file.  Zero-filling the padding is
> necessary.

If zero-filling the padding is in any sense necessary, there is
something somewhere else that's broken.

Unless gcc promises more than C does about padding bytes, that is.  I
can't recall seeing any such promise in the gcc doc; did I miss one?

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML