Subject: Re: file id alignment
To: None <martin@duskware.de>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 06/30/2006 18:39:08
> @@ -335,15 +336,15 @@ tmpfs_fhtovp(struct mount *mp, struct fi
>  static int
>  tmpfs_vptofh(struct vnode *vp, struct fid *fhp)
>  {
> -	struct tmpfs_fid *tfhp;
> +	struct tmpfs_fid tfh;
>  	struct tmpfs_node *node;
>  
> -	tfhp = (struct tmpfs_fid *)fhp;
>  	node = VP_TO_TMPFS_NODE(vp);
>  
> -	tfhp->tf_len = sizeof(struct tmpfs_fid);
> -	tfhp->tf_id = node->tn_id;
> -	tfhp->tf_gen = node->tn_gen;
> +	tfh.tf_len = sizeof(struct tmpfs_fid);
> +	tfh.tf_id = node->tn_id;
> +	tfh.tf_gen = node->tn_gen;
> +	memcpy(fid, &tfh, sizeof tfh);

you need to ensure that any padding bytes in tfh are properly initialized.

YAMAMOTO Takashi