diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-08 19:21:09 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-08 19:21:09 +0000 |
commit | c313d136c06aee58dc42234d410ff90569d1f4bf (patch) | |
tree | f2347eff045928a0c311d9f90edcecca43247a4c /lib/libc | |
parent | a19207e6c155735497fd81e1873c90b634878ebb (diff) |
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
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 2ce545c5faa..a94e362ceb2 100644 --- a/lib/libc/stdlib/malloc.c +++ b/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 <otto@drijf.net> * @@ -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 */ |