sparc64/143010: commit references a PR
dfilter service
dfilter at FreeBSD.ORG
Sun Jan 31 22:20:03 UTC 2010
The following reply was made to PR sparc64/143010; it has been noted by GNATS.
From: dfilter at FreeBSD.ORG (dfilter service)
To: bug-followup at FreeBSD.org
Cc:
Subject: Re: sparc64/143010: commit references a PR
Date: Sun, 31 Jan 2010 22:16:41 +0000 (UTC)
Author: marius
Date: Sun Jan 31 22:16:27 2010
New Revision: 203326
URL: http://svn.freebsd.org/changeset/base/203326
Log:
MFC: r202903
On LP64 struct ifid is 64-bit aligned while struct fid is 32-bit aligned
so on architectures with strict alignment requirements we can't just simply
cast the latter to the former but need to copy it bytewise instead.
PR: 143010
Approved by: re (kib)
Modified:
stable/7/sys/fs/cd9660/cd9660_vfsops.c
stable/7/sys/fs/cd9660/cd9660_vnops.c
Directory Properties:
stable/7/sys/ (props changed)
stable/7/sys/cddl/contrib/opensolaris/ (props changed)
stable/7/sys/contrib/dev/acpica/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
Modified: stable/7/sys/fs/cd9660/cd9660_vfsops.c
==============================================================================
--- stable/7/sys/fs/cd9660/cd9660_vfsops.c Sun Jan 31 22:08:52 2010 (r203325)
+++ stable/7/sys/fs/cd9660/cd9660_vfsops.c Sun Jan 31 22:16:27 2010 (r203326)
@@ -596,17 +596,19 @@ cd9660_fhtovp(mp, fhp, vpp)
struct fid *fhp;
struct vnode **vpp;
{
- struct ifid *ifhp = (struct ifid *)fhp;
+ struct ifid ifh;
struct iso_node *ip;
struct vnode *nvp;
int error;
+ memcpy(&ifh, fhp, sizeof(ifh));
+
#ifdef ISOFS_DBG
printf("fhtovp: ino %d, start %ld\n",
- ifhp->ifid_ino, ifhp->ifid_start);
+ ifh.ifid_ino, ifh.ifid_start);
#endif
- if ((error = VFS_VGET(mp, ifhp->ifid_ino, LK_EXCLUSIVE, &nvp)) != 0) {
+ if ((error = VFS_VGET(mp, ifh.ifid_ino, LK_EXCLUSIVE, &nvp)) != 0) {
*vpp = NULLVP;
return (error);
}
Modified: stable/7/sys/fs/cd9660/cd9660_vnops.c
==============================================================================
--- stable/7/sys/fs/cd9660/cd9660_vnops.c Sun Jan 31 22:08:52 2010 (r203325)
+++ stable/7/sys/fs/cd9660/cd9660_vnops.c Sun Jan 31 22:16:27 2010 (r203326)
@@ -828,20 +828,25 @@ cd9660_vptofh(ap)
struct fid *a_fhp;
} */ *ap;
{
+ struct ifid ifh;
struct iso_node *ip = VTOI(ap->a_vp);
- struct ifid *ifhp;
- ifhp = (struct ifid *)ap->a_fhp;
- ifhp->ifid_len = sizeof(struct ifid);
+ ifh.ifid_len = sizeof(struct ifid);
- ifhp->ifid_ino = ip->i_number;
- ifhp->ifid_start = ip->iso_start;
+ ifh.ifid_ino = ip->i_number;
+ ifh.ifid_start = ip->iso_start;
+ /*
+ * This intentionally uses sizeof(ifh) in order to not copy stack
+ * garbage on ILP32.
+ */
+ memcpy(ap->a_fhp, &ifh, sizeof(ifh));
#ifdef ISOFS_DBG
printf("vptofh: ino %d, start %ld\n",
- ifhp->ifid_ino,ifhp->ifid_start);
+ ifh.ifid_ino, ifh.ifid_start);
#endif
- return 0;
+
+ return (0);
}
/*
_______________________________________________
svn-src-all at freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe at freebsd.org"
More information about the freebsd-sparc64
mailing list