summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2013-04-06 06:10:34 +0000
committertedu <tedu@openbsd.org>2013-04-06 06:10:34 +0000
commit410af4be8617ed9366eaa1a817ed8c2138ccea7e (patch)
treeb4a140c17fd57ef3aa8549033b6f4f800f5d878b
parenti missed a file, crap. found by deraadt (diff)
downloadwireguard-openbsd-410af4be8617ed9366eaa1a817ed8c2138ccea7e.tar.xz
wireguard-openbsd-410af4be8617ed9366eaa1a817ed8c2138ccea7e.zip
i missed this file too.
-rw-r--r--sys/kern/subr_poison.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/kern/subr_poison.c b/sys/kern/subr_poison.c
index f3bf077ff6a..e8038bc3320 100644
--- a/sys/kern/subr_poison.c
+++ b/sys/kern/subr_poison.c
@@ -16,7 +16,7 @@
*/
#include <sys/types.h>
-#include <sys/systm.h>
+#include <sys/malloc.h>
/*
* The POISON is used as known text to copy into free objects so
@@ -27,33 +27,44 @@
#else
#define POISON ((unsigned) 0xdeadbeef)
#endif
-#define POISON_SIZE 32
+#define POISON_SIZE 64
+
+int32_t
+poison_value(void *v)
+{
+ return POISON;
+}
void
poison_mem(void *v, size_t len)
{
uint32_t *ip = v;
size_t i;
+ int32_t poison;
+
+ poison = poison_value(v);
if (len > POISON_SIZE)
len = POISON_SIZE;
len = len / sizeof(*ip);
for (i = 0; i < len; i++)
- ip[i] = POISON;
+ ip[i] = poison;
}
int
poison_check(void *v, size_t len, size_t *pidx, int *pval)
{
-
uint32_t *ip = v;
size_t i;
+ int32_t poison;
+
+ poison = poison_value(v);
if (len > POISON_SIZE)
len = POISON_SIZE;
len = len / sizeof(*ip);
for (i = 0; i < len; i++) {
- if (ip[i] != POISON) {
+ if (ip[i] != poison) {
*pidx = i;
*pval = ip[i];
return 1;