summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2009-11-14 18:14:07 +0000
committermarcel <marcel@FreeBSD.org>2009-11-14 18:14:07 +0000
commit272f28263b1eec62691d61e72818912396f7d5e5 (patch)
treeed14151b006b380b18a269c3021ce6db76053f47 /sys/nfsserver
parent6ca2296a1ba7d79ea4c890c09191fb27e9ef7bdf (diff)
downloadFreeBSD-src-272f28263b1eec62691d61e72818912396f7d5e5.zip
FreeBSD-src-272f28263b1eec62691d61e72818912396f7d5e5.tar.gz
Fix an obvious panic by not casting from a pointer that is 4-bytes
alignment to a type that needs 8-byte alignment, and thus causing misaligned memory references. MFC after: 1 week
Diffstat (limited to 'sys/nfsserver')
-rw-r--r--sys/nfsserver/nfs_fha.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/nfsserver/nfs_fha.c b/sys/nfsserver/nfs_fha.c
index 901a0ce..cad13dd 100644
--- a/sys/nfsserver/nfs_fha.c
+++ b/sys/nfsserver/nfs_fha.c
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/sysproto.h>
#include <sys/kernel.h>
+#include <sys/endian.h>
#include <sys/sysctl.h>
#include <sys/vnode.h>
#include <sys/malloc.h>
@@ -206,7 +207,11 @@ fha_extract_info(struct svc_req *req, struct fha_info *i)
if (error)
goto out;
- i->fh = *(const u_int64_t *)(fh.fh_generic.fh_fid.fid_data);
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+ i->fh = le64dec(fh.fh_generic.fh_fid.fid_data);
+#else
+ i->fh = be64dec(fh.fh_generic.fh_fid.fid_data);
+#endif
/* Content ourselves with zero offset for all but reads. */
if (procnum != NFSPROC_READ)
OpenPOWER on IntegriCloud