summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <>2013-11-12 06:57:54 +0000
committerderaadt <>2013-11-12 06:57:54 +0000
commitdb8563fae52c772be6669f5e4b37165f979e3424 (patch)
tree0b94c87349066403421e320d50170fdb9d5ae813
parent92310eb0400efc52093dc7597258a25953dee16b (diff)
downloadopenbsd-db8563fae52c772be6669f5e4b37165f979e3424.tar.gz
openbsd-db8563fae52c772be6669f5e4b37165f979e3424.tar.bz2
openbsd-db8563fae52c772be6669f5e4b37165f979e3424.zip
avoid arithetic on void *
ok guenther otto
-rw-r--r--src/lib/libc/stdlib/malloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c
index af17587552..545e51e2ac 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.149 2012/12/22 07:32:17 otto Exp $ */ 1/* $OpenBSD: malloc.c,v 1.150 2013/11/12 06:57:54 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> 3 * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
4 * 4 *
@@ -717,7 +717,7 @@ alloc_chunk_info(struct dir_info *d, int bits)
717 size = ALIGN(size); 717 size = ALIGN(size);
718 718
719 if (LIST_EMPTY(&d->chunk_info_list[bits])) { 719 if (LIST_EMPTY(&d->chunk_info_list[bits])) {
720 void *q; 720 char *q;
721 int i; 721 int i;
722 722
723 q = MMAP(MALLOC_PAGESIZE); 723 q = MMAP(MALLOC_PAGESIZE);
@@ -1436,7 +1436,7 @@ calloc(size_t nmemb, size_t size)
1436static void * 1436static void *
1437mapalign(struct dir_info *d, size_t alignment, size_t sz, int zero_fill) 1437mapalign(struct dir_info *d, size_t alignment, size_t sz, int zero_fill)
1438{ 1438{
1439 void *p, *q; 1439 char *p, *q;
1440 1440
1441 if (alignment < MALLOC_PAGESIZE || ((alignment - 1) & alignment) != 0) { 1441 if (alignment < MALLOC_PAGESIZE || ((alignment - 1) & alignment) != 0) {
1442 wrterror("mapalign bad alignment", NULL); 1442 wrterror("mapalign bad alignment", NULL);
@@ -1459,7 +1459,7 @@ mapalign(struct dir_info *d, size_t alignment, size_t sz, int zero_fill)
1459 p = map(d, sz + alignment, zero_fill); 1459 p = map(d, sz + alignment, zero_fill);
1460 if (p == MAP_FAILED) 1460 if (p == MAP_FAILED)
1461 return MAP_FAILED; 1461 return MAP_FAILED;
1462 q = (void *)(((uintptr_t)p + alignment - 1) & ~(alignment - 1)); 1462 q = (char *)(((uintptr_t)p + alignment - 1) & ~(alignment - 1));
1463 if (q != p) { 1463 if (q != p) {
1464 if (munmap(p, q - p)) 1464 if (munmap(p, q - p))
1465 wrterror("munmap", p); 1465 wrterror("munmap", p);