diff options
author | deraadt <> | 2009-06-08 19:21:08 +0000 |
---|---|---|
committer | deraadt <> | 2009-06-08 19:21:08 +0000 |
commit | 80e967e04f7120cece850403865e23a9a9d1b58c (patch) | |
tree | dffef0390ceb1369bccb34e875432990d49ee09d /src | |
parent | 8fa7f48f288fa685ee14a1f340f1eab743a66427 (diff) | |
download | openbsd-80e967e04f7120cece850403865e23a9a9d1b58c.tar.gz openbsd-80e967e04f7120cece850403865e23a9a9d1b58c.tar.bz2 openbsd-80e967e04f7120cece850403865e23a9a9d1b58c.zip |
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 'src')
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 2ce545c5fa..a94e362ceb 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc.c,v 1.115 2009/01/03 12:58:28 djm Exp $ */ | 1 | /* $OpenBSD: malloc.c,v 1.116 2009/06/08 19:21:08 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> |
4 | * | 4 | * |
@@ -472,7 +472,7 @@ map(struct dir_info *d, size_t sz, int zero_fill) | |||
472 | u_int i, offset; | 472 | u_int i, offset; |
473 | void *p; | 473 | void *p; |
474 | 474 | ||
475 | if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)d) || | 475 | if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)(uintptr_t)d) || |
476 | d->canary1 != ~d->canary2) | 476 | d->canary1 != ~d->canary2) |
477 | wrterror("internal struct corrupt"); | 477 | wrterror("internal struct corrupt"); |
478 | if (sz != PAGEROUND(sz)) { | 478 | if (sz != PAGEROUND(sz)) { |
@@ -716,7 +716,7 @@ omalloc_init(struct dir_info **dp) | |||
716 | } | 716 | } |
717 | malloc_used += regioninfo_size; | 717 | malloc_used += regioninfo_size; |
718 | memset(d->r, 0, regioninfo_size); | 718 | memset(d->r, 0, regioninfo_size); |
719 | d->canary1 = mopts.malloc_canary ^ (u_int32_t)d; | 719 | d->canary1 = mopts.malloc_canary ^ (u_int32_t)(uintptr_t)d; |
720 | d->canary2 = ~d->canary1; | 720 | d->canary2 = ~d->canary1; |
721 | 721 | ||
722 | *dp = d; | 722 | *dp = d; |
@@ -845,7 +845,7 @@ find(struct dir_info *d, void *p) | |||
845 | size_t mask = d->regions_total - 1; | 845 | size_t mask = d->regions_total - 1; |
846 | void *q, *r; | 846 | void *q, *r; |
847 | 847 | ||
848 | if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)d) || | 848 | if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)(uintptr_t)d) || |
849 | d->canary1 != ~d->canary2) | 849 | d->canary1 != ~d->canary2) |
850 | wrterror("internal struct corrupt"); | 850 | wrterror("internal struct corrupt"); |
851 | p = MASK_POINTER(p); | 851 | p = MASK_POINTER(p); |
@@ -973,7 +973,7 @@ malloc_bytes(struct dir_info *d, size_t size) | |||
973 | u_long u, *lp; | 973 | u_long u, *lp; |
974 | struct chunk_info *bp; | 974 | struct chunk_info *bp; |
975 | 975 | ||
976 | if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)d) || | 976 | if (mopts.malloc_canary != (d->canary1 ^ (u_int32_t)(uintptr_t)d) || |
977 | d->canary1 != ~d->canary2) | 977 | d->canary1 != ~d->canary2) |
978 | wrterror("internal struct corrupt"); | 978 | wrterror("internal struct corrupt"); |
979 | /* Don't bother with anything less than this */ | 979 | /* Don't bother with anything less than this */ |