summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2013-04-06 06:10:35 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2013-04-06 06:10:35 +0000
commit322d56dbce4946a3b549652a44852407933012f3 (patch)
tree0506180c5e486a8c9a294310304c2b45d7592e7f
parent809e6b0a69a573551c100b975c12360ba3e53e2c (diff)
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;