diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-07-05 16:32:08 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-07-05 16:32:08 +0000 |
commit | 6d43a353f8c7d62c0c6ed445a5813df535c2c578 (patch) | |
tree | cdc07c0c9fd9d7cd876c64e6295124659667fd90 /sys/nfs | |
parent | adffdc7afa64dd49c3e08a34fb61ac1082e27bb8 (diff) |
If we find something is not aligned according to ALIGNED_POINTER(), we
cannot then re-align it using ALIGN(). That is not portable since we
have architectures where the modulo are quite different. define an
ALIGN_POINTER() macro in place, and use it in one spot.
This caused a NFS crash on sparc (which borrows mbufs and chains them
itself in insane ways). I heard claudio and beck trying to diagnose
it from over the room when suddenly I knew exactly what it was.
blambert spent a few hours on it making sure that I wasn't insane.
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_socket.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index ca9babb4aeb..4b8b718f725 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_socket.c,v 1.97 2010/07/02 02:40:17 blambert Exp $ */ +/* $OpenBSD: nfs_socket.c,v 1.98 2010/07/05 16:32:07 deraadt Exp $ */ /* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */ /* @@ -1391,7 +1391,8 @@ nfs_realign(struct mbuf **pm, int hsiz) if (!ALIGNED_POINTER(m->m_data, void *) || !ALIGNED_POINTER(m->m_len, void *)) { MGET(n, M_WAIT, MT_DATA); - if (ALIGN(m->m_len) >= MINCLSIZE) { +#define ALIGN_POINTER(n) ((u_int)(((n) + sizeof(void *)) & ~sizeof(void *))) + if (ALIGN_POINTER(m->m_len) >= MINCLSIZE) { MCLGET(n, M_WAIT); } n->m_len = 0; |