From d4f78c2955029cf41d15be7be2d584fca2ded952 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Mon, 8 Jun 2009 19:21:08 +0000 Subject: [PATCH] quieten compiler by converting pointers to uintptr_t before truncating them to u_int32_t to do integer math with (in a situation where that is legit) ok otto millert --- src/lib/libc/stdlib/malloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 2ce545c5..a94e362c 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.115 2009/01/03 12:58:28 djm Exp $ */ +/* $OpenBSD: malloc.c,v 1.116 2009/06/08 19:21:08 deraadt Exp $ */ /* * Copyright (c) 2008 Otto Moerbeek * @@ -472,7 +472,7 @@ map(struct dir_info *d, size_t sz, int zero_fill) u_int i, offset; void *p; - if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)d) || + if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)(uintptr_t)d) || d->canary1 != ~d->canary2) wrterror("internal struct corrupt"); if (sz != PAGEROUND(sz)) { @@ -716,7 +716,7 @@ omalloc_init(struct dir_info **dp) } malloc_used += regioninfo_size; memset(d->r, 0, regioninfo_size); - d->canary1 = mopts.malloc_canary ^ (u_int32_t)d; + d->canary1 = mopts.malloc_canary ^ (u_int32_t)(uintptr_t)d; d->canary2 = ~d->canary1; *dp = d; @@ -845,7 +845,7 @@ find(struct dir_info *d, void *p) size_t mask = d->regions_total - 1; void *q, *r; - if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)d) || + if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)(uintptr_t)d) || d->canary1 != ~d->canary2) wrterror("internal struct corrupt"); p = MASK_POINTER(p); @@ -973,7 +973,7 @@ malloc_bytes(struct dir_info *d, size_t size) u_long u, *lp; struct chunk_info *bp; - if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)d) || + if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)(uintptr_t)d) || d->canary1 != ~d->canary2) wrterror("internal struct corrupt"); /* Don't bother with anything less than this */