summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-12-27 23:57:07 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-12-27 23:57:07 +0000
commitd27fa0276802ab576caeb34ef3bc6e9551ce7e45 (patch)
tree4ba90a0d5e39976810b45ff74792af9f1a687e2f /sys/arch/mvme88k
parent6a687975b0ca06aac97c3ffbe1bf2fc6ab9a4ad0 (diff)
Handle odd sizes in d16_bcopy() and d16_bzero().
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r--sys/arch/mvme88k/dev/vmes.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/arch/mvme88k/dev/vmes.c b/sys/arch/mvme88k/dev/vmes.c
index 2a81cf8c7f9..6352ebedea0 100644
--- a/sys/arch/mvme88k/dev/vmes.c
+++ b/sys/arch/mvme88k/dev/vmes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmes.c,v 1.14 2003/12/25 21:01:39 miod Exp $ */
+/* $OpenBSD: vmes.c,v 1.15 2003/12/27 23:57:06 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -190,18 +190,24 @@ d16_bcopy(const void *src, void *dst, size_t len)
{
const u_int16_t *s = (const u_int16_t *)src;
u_int16_t *d = (u_int16_t *)dst;
+ size_t l = len;
- len >>= 1;
- while (len-- != 0)
+ l >>= 1;
+ while (l-- != 0)
*d++ = *s++;
+ if (len & 1)
+ *(u_int8_t *)d = *(u_int8_t *)s;
}
void
d16_bzero(void *dst, size_t len)
{
u_int16_t *d = (u_int16_t *)dst;
+ size_t l = len;
- len >>= 1;
- while (len-- != 0)
+ l >>= 1;
+ while (l-- != 0)
*d++ = 0;
+ if (len & 1)
+ *(u_int8_t *)d = 0;
}