From: tedu Date: Mon, 19 May 2014 14:30:03 +0000 (+0000) Subject: consistent use of uint32_t for poison values X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2d02adf8285b02d67be5c9379a7f5b0c41bae06d;p=openbsd consistent use of uint32_t for poison values --- diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 1862aa171cd..96e90d3e048 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.106 2014/04/03 21:36:59 tedu Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.107 2014/05/19 14:30:03 tedu Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -325,7 +325,7 @@ malloc(unsigned long size, int type, int flags) /* and check that the data hasn't been modified. */ if (freshalloc == 0) { size_t pidx; - int pval; + uint32_t pval; if (poison_check(va, allocsize, &pidx, &pval)) { panic("%s %zd of object %p size 0x%lx %s %s" " (0x%x != 0x%x)\n", diff --git a/sys/kern/subr_poison.c b/sys/kern/subr_poison.c index 62090621508..b815404efef 100644 --- a/sys/kern/subr_poison.c +++ b/sys/kern/subr_poison.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_poison.c,v 1.6 2014/01/13 09:27:39 mpi Exp $ */ +/* $OpenBSD: subr_poison.c,v 1.7 2014/05/19 14:30:03 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst * @@ -36,7 +36,7 @@ #endif #define POISON_SIZE 64 -int32_t +uint32_t poison_value(void *v) { ulong l = (u_long)v; @@ -51,7 +51,7 @@ poison_mem(void *v, size_t len) { uint32_t *ip = v; size_t i; - int32_t poison; + uint32_t poison; poison = poison_value(v); @@ -63,11 +63,11 @@ poison_mem(void *v, size_t len) } int -poison_check(void *v, size_t len, size_t *pidx, int *pval) +poison_check(void *v, size_t len, size_t *pidx, uint32_t *pval) { uint32_t *ip = v; size_t i; - int32_t poison; + uint32_t poison; poison = poison_value(v); diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index 5cae063a964..2dab25cbd76 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_pool.c,v 1.127 2014/05/01 04:25:02 tedu Exp $ */ +/* $OpenBSD: subr_pool.c,v 1.128 2014/05/19 14:30:03 tedu Exp $ */ /* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */ /*- @@ -643,7 +643,7 @@ startover: pp->pr_wchan, ph->ph_page, pi, 0, pi->pi_magic); if (pool_debug && ph->ph_magic) { size_t pidx; - int pval; + uint32_t pval; if (poison_check(pi + 1, pp->pr_size - sizeof(*pi), &pidx, &pval)) { int *ip = (int *)(pi + 1); @@ -1314,7 +1314,7 @@ pool_chk_page(struct pool *pp, struct pool_item_header *ph, int expected) } if (pool_debug && ph->ph_magic) { size_t pidx; - int pval; + uint32_t pval; if (poison_check(pi + 1, pp->pr_size - sizeof(*pi), &pidx, &pval)) { int *ip = (int *)(pi + 1); diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 30f6fcc3771..b04b6f712e4 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.h,v 1.107 2013/06/03 15:56:01 tedu Exp $ */ +/* $OpenBSD: malloc.h,v 1.108 2014/05/19 14:30:03 tedu Exp $ */ /* $NetBSD: malloc.h,v 1.39 1998/07/12 19:52:01 augustss Exp $ */ /* @@ -400,8 +400,8 @@ size_t malloc_roundup(size_t); void malloc_printit(int (*)(const char *, ...)); void poison_mem(void *, size_t); -int poison_check(void *, size_t, size_t *, int *); -int32_t poison_value(void *); +int poison_check(void *, size_t, size_t *, uint32_t *); +uint32_t poison_value(void *); #ifdef MALLOC_DEBUG int debug_malloc(unsigned long, int, int, void **);