summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/malloc.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2013-11-12 06:57:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2013-11-12 06:57:55 +0000
commita91534e73e1b68c0f2cd142d5631e28703f2d134 (patch)
tree8d2c35e5c471ecbd42d53004a568fd75d8f31015 /lib/libc/stdlib/malloc.c
parent03e65f52ada0934c404e833554de235e9c61b358 (diff)
avoid arithetic on void *
ok guenther otto
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
-rw-r--r--lib/libc/stdlib/malloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index af175875520..545e51e2ac3 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.c,v 1.149 2012/12/22 07:32:17 otto Exp $ */
+/* $OpenBSD: malloc.c,v 1.150 2013/11/12 06:57:54 deraadt Exp $ */
/*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
*
@@ -717,7 +717,7 @@ alloc_chunk_info(struct dir_info *d, int bits)
size = ALIGN(size);
if (LIST_EMPTY(&d->chunk_info_list[bits])) {
- void *q;
+ char *q;
int i;
q = MMAP(MALLOC_PAGESIZE);
@@ -1436,7 +1436,7 @@ calloc(size_t nmemb, size_t size)
static void *
mapalign(struct dir_info *d, size_t alignment, size_t sz, int zero_fill)
{
- void *p, *q;
+ char *p, *q;
if (alignment < MALLOC_PAGESIZE || ((alignment - 1) & alignment) != 0) {
wrterror("mapalign bad alignment", NULL);
@@ -1459,7 +1459,7 @@ mapalign(struct dir_info *d, size_t alignment, size_t sz, int zero_fill)
p = map(d, sz + alignment, zero_fill);
if (p == MAP_FAILED)
return MAP_FAILED;
- q = (void *)(((uintptr_t)p + alignment - 1) & ~(alignment - 1));
+ q = (char *)(((uintptr_t)p + alignment - 1) & ~(alignment - 1));
if (q != p) {
if (munmap(p, q - p))
wrterror("munmap", p);