summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2005-09-28 20:53:54 +0000
committermiod <miod@openbsd.org>2005-09-28 20:53:54 +0000
commit128e989f6463084bca9136088bd6ae5daba3bb25 (patch)
tree3d6c80b454216268fd22903f713e8d304684a0f7
parentfix a use after free and let exit clean up instead. ok drahn@ (diff)
downloadwireguard-openbsd-128e989f6463084bca9136088bd6ae5daba3bb25.tar.xz
wireguard-openbsd-128e989f6463084bca9136088bd6ae5daba3bb25.zip
No part of the code defines UNALIGNED_ACCESS, use reverted tests for
__STRICT_ALIGNMENT instead. Help pedro@ deraadt@, ok deraadt@
-rw-r--r--sys/isofs/cd9660/iso.h34
-rw-r--r--sys/msdosfs/bpb.h4
-rw-r--r--sys/net/bpf_filter.c5
3 files changed, 22 insertions, 21 deletions
diff --git a/sys/isofs/cd9660/iso.h b/sys/isofs/cd9660/iso.h
index 99a1f688de1..2753905c9a7 100644
--- a/sys/isofs/cd9660/iso.h
+++ b/sys/isofs/cd9660/iso.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iso.h,v 1.13 2003/06/02 23:28:05 millert Exp $ */
+/* $OpenBSD: iso.h,v 1.14 2005/09/28 20:53:54 miod Exp $ */
/* $NetBSD: iso.h,v 1.20 1997/07/07 22:45:34 cgd Exp $ */
/*-
@@ -203,8 +203,8 @@ static __inline int
isonum_721(p)
u_char *p;
{
-#if defined(UNALIGNED_ACCESS) && (BYTE_ORDER == LITTLE_ENDIAN)
- return *(u_int16t *)p;
+#if !defined(__STRICT_ALIGNMENT) && (BYTE_ORDER == LITTLE_ENDIAN)
+ return *(u_int16_t *)p;
#else
return *p|((char)p[1] << 8);
#endif
@@ -215,8 +215,8 @@ static __inline int
isonum_722(p)
unsigned char *p;
{
-#if defined(UNALIGNED_ACCESS) && (BYTE_ORDER == BIG_ENDIAN)
- return *(u_int16t *)p;
+#if !defined(__STRICT_ALIGNMENT) && (BYTE_ORDER == BIG_ENDIAN)
+ return *(u_int16_t *)p;
#else
return ((char)*p << 8)|p[1];
#endif
@@ -226,14 +226,14 @@ isonum_722(p)
static __inline int
isonum_723(u_char *p)
{
-#if defined(UNALIGNED_ACCESS) && \
+#if !defined(__STRICT_ALIGNMENT) && \
((BYTE_ORDER == LITTLE_ENDIAN) || (BYTE_ORDER == BIG_ENDIAN))
#if BYTE_ORDER == LITTLE_ENDIAN
- return *(u_int16t *)p;
+ return *(u_int16_t *)p;
#else
- return *(u_int16t *)(p + 2);
+ return *(u_int16_t *)(p + 2);
#endif
-#else /* !UNALIGNED_ACCESS or weird byte order */
+#else /* __STRICT_ALIGNMENT or weird byte order */
return *p|(p[1] << 8);
#endif
}
@@ -243,8 +243,8 @@ static __inline int
isonum_731(p)
u_char *p;
{
-#if defined(UNALIGNED_ACCESS) && (BYTE_ORDER == LITTLE_ENDIAN)
- return *(u_int32t *)p;
+#if !defined(__STRICT_ALIGNMENT) && (BYTE_ORDER == LITTLE_ENDIAN)
+ return *(u_int32_t *)p;
#else
return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24);
#endif
@@ -255,8 +255,8 @@ static __inline int
isonum_732(p)
unsigned char *p;
{
-#if defined(UNALIGNED_ACCESS) && (BYTE_ORDER == BIG_ENDIAN)
- return *(u_int32t *)p;
+#if !defined(__STRICT_ALIGNMENT) && (BYTE_ORDER == BIG_ENDIAN)
+ return *(u_int32_t *)p;
#else
return (*p << 24)|(p[1] << 16)|(p[2] << 8)|p[3];
#endif
@@ -266,14 +266,14 @@ isonum_732(p)
static __inline int
isonum_733(u_char *p)
{
-#if defined(UNALIGNED_ACCESS) && \
+#if !defined(__STRICT_ALIGNMENT) && \
((BYTE_ORDER == LITTLE_ENDIAN) || (BYTE_ORDER == BIG_ENDIAN))
#if BYTE_ORDER == LITTLE_ENDIAN
- return *(u_int32t *)p;
+ return *(u_int32_t *)p;
#else
- return *(u_int32t *)(p + 4);
+ return *(u_int32_t *)(p + 4);
#endif
-#else /* !UNALIGNED_ACCESS or weird byte order */
+#else /* __STRICT_ALIGNMENT or weird byte order */
return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24);
#endif
}
diff --git a/sys/msdosfs/bpb.h b/sys/msdosfs/bpb.h
index 399e592530b..0817efb91c5 100644
--- a/sys/msdosfs/bpb.h
+++ b/sys/msdosfs/bpb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpb.h,v 1.3 1998/01/11 20:39:03 provos Exp $ */
+/* $OpenBSD: bpb.h,v 1.4 2005/09/28 20:53:56 miod Exp $ */
/* $NetBSD: bpb.h,v 1.6 1997/10/17 11:23:35 ws Exp $ */
/*
@@ -114,7 +114,7 @@ struct bpb_a {
* use the macros for the big-endian case.
*/
#include <machine/endian.h>
-#if (BYTE_ORDER == LITTLE_ENDIAN) && defined(UNALIGNED_ACCESS)
+#if (BYTE_ORDER == LITTLE_ENDIAN) && !defined(__STRICT_ALIGNMENT)
#define getushort(x) *((u_int16_t *)(x))
#define getulong(x) *((u_int32_t *)(x))
#define putushort(p, v) (*((u_int16_t *)(p)) = (v))
diff --git a/sys/net/bpf_filter.c b/sys/net/bpf_filter.c
index fe9063a4840..e33b66dbae9 100644
--- a/sys/net/bpf_filter.c
+++ b/sys/net/bpf_filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf_filter.c,v 1.14 2004/04/26 08:10:10 otto Exp $ */
+/* $OpenBSD: bpf_filter.c,v 1.15 2005/09/28 20:53:56 miod Exp $ */
/* $NetBSD: bpf_filter.c,v 1.12 1996/02/13 22:00:00 christos Exp $ */
/*
@@ -45,7 +45,8 @@
#include "pcap.h"
#endif
-#ifndef UNALIGNED_ACCESS
+#include <sys/endian.h>
+#ifdef __STRICT_ALIGNMENT
#define BPF_ALIGN
#endif