diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-10-06 22:29:46 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-10-06 22:29:46 +0000 |
commit | 4ada4f1a9af9c58a224afa1673f94fec75f54337 (patch) | |
tree | 01f06386bd44a8d452c7d2e2d0fbdc6dac888698 /lib/libarch/alpha | |
parent | 03dc0b5e06fee7cdcdd3213ddb16b576d58004c5 (diff) |
munmap() the correct size; adapted from PR #3462
ok matthieu@
Diffstat (limited to 'lib/libarch/alpha')
-rw-r--r-- | lib/libarch/alpha/bwx.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/libarch/alpha/bwx.c b/lib/libarch/alpha/bwx.c index 42964c634f3..5fbf1fc80ad 100644 --- a/lib/libarch/alpha/bwx.c +++ b/lib/libarch/alpha/bwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwx.c,v 1.3 2002/08/24 17:21:44 matthieu Exp $ */ +/* $OpenBSD: bwx.c,v 1.4 2003/10/06 22:29:45 miod Exp $ */ /*- * Copyright (c) 1998 Doug Rabson * All rights reserved. @@ -182,30 +182,31 @@ static void * bwx_map_memory(u_int32_t address, u_int32_t size) { struct bwx_mem_handle *h; + size_t sz = (size_t)size << 5; h = malloc(sizeof(struct bwx_mem_handle)); if (h == NULL) return NULL; bwx_open_mem(); - h->virt1 = mmap(0, size << 5, PROT_READ|PROT_WRITE, MAP_SHARED, + h->virt1 = mmap(0, sz, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, bwx_mem_base + BWX_EV56_INT1 + address); if (h->virt1 == MAP_FAILED) { bwx_close_mem(); free(h); return NULL; } - h->virt2 = mmap(0, size << 5, PROT_READ|PROT_WRITE, MAP_SHARED, + h->virt2 = mmap(0, sz, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, bwx_mem_base + BWX_EV56_INT2 + address); if (h->virt2 == MAP_FAILED) { - munmap(h->virt1, size); + munmap(h->virt1, sz); bwx_close_mem(); free(h); return NULL; } - h->virt4 = mmap(0, size << 5, PROT_READ|PROT_WRITE, MAP_SHARED, + h->virt4 = mmap(0, sz, PROT_READ|PROT_WRITE, MAP_SHARED, mem_fd, bwx_mem_base + BWX_EV56_INT4 + address); if (h->virt4 == MAP_FAILED) { - munmap(h->virt1, size); - munmap(h->virt2, size); + munmap(h->virt1, sz); + munmap(h->virt2, sz); bwx_close_mem(); free(h); return NULL; @@ -218,10 +219,11 @@ static void bwx_unmap_memory(void *handle, u_int32_t size) { struct bwx_mem_handle *h = handle; + size_t sz = (size_t)size << 5; - munmap(h->virt1, size); - munmap(h->virt2, size); - munmap(h->virt4, size); + munmap(h->virt1, sz); + munmap(h->virt2, sz); + munmap(h->virt4, sz); free(h); } |