summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_swap.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-11-13 03:56:52 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-11-13 03:56:52 +0000
commitf9b0e88e8c5046e057cfbf0d01a43cd74401397b (patch)
treeff35eeefc306c9a51d1b1bcbbc137cf274c969a8 /sys/uvm/uvm_swap.c
parent390a7210a0fbf82995e43dd58d300c6bc4b35d74 (diff)
sizes for simple frees. new diff without the bug spotted by deraadt
Diffstat (limited to 'sys/uvm/uvm_swap.c')
-rw-r--r--sys/uvm/uvm_swap.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index f80cae56cea..8e9de8ebf04 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_swap.c,v 1.128 2014/07/12 18:44:01 tedu Exp $ */
+/* $OpenBSD: uvm_swap.c,v 1.129 2014/11/13 03:56:51 tedu Exp $ */
/* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */
/*
@@ -497,7 +497,7 @@ swaplist_insert(struct swapdev *sdp, struct swappri *newspp, int priority)
LIST_INSERT_HEAD(&swap_priority, spp, spi_swappri);
} else {
/* we don't need a new priority structure, free it */
- free(newspp, M_VMSWAP, 0);
+ free(newspp, M_VMSWAP, sizeof(*newspp));
}
/*
@@ -555,7 +555,7 @@ swaplist_trim(void)
if (!TAILQ_EMPTY(&spp->spi_swapdev))
continue;
LIST_REMOVE(spp, spi_swappri);
- free(spp, M_VMSWAP, 0);
+ free(spp, M_VMSWAP, sizeof(*spp));
}
}
@@ -728,7 +728,7 @@ sys_swapctl(struct proc *p, void *v, register_t *retval)
swaplist_trim();
}
if (error)
- free(spp, M_VMSWAP, 0);
+ free(spp, M_VMSWAP, sizeof(*spp));
break;
case SWAP_ON:
/*
@@ -776,7 +776,7 @@ sys_swapctl(struct proc *p, void *v, register_t *retval)
crfree(sdp->swd_cred);
}
free(sdp->swd_path, M_VMSWAP, 0);
- free(sdp, M_VMSWAP, 0);
+ free(sdp, M_VMSWAP, sizeof(*sdp));
break;
}
break;
@@ -1052,7 +1052,8 @@ swap_off(struct proc *p, struct swapdev *sdp)
extent_free(swapmap, sdp->swd_drumoffset, sdp->swd_drumsize,
EX_WAITOK);
extent_destroy(sdp->swd_ex);
- free(sdp, M_VMSWAP, 0);
+ /* free sdp->swd_path ? */
+ free(sdp, M_VMSWAP, sizeof(*sdp));
return (0);
}
@@ -1910,8 +1911,8 @@ swapmount(void)
#endif
if (bdevvp(swap_dev, &vp)) {
free(sdp->swd_path, M_VMSWAP, 0);
- free(sdp, M_VMSWAP, 0);
- free(spp, M_VMSWAP, 0);
+ free(sdp, M_VMSWAP, sizeof(*sdp));
+ free(spp, M_VMSWAP, sizeof(*spp));
return;
}
@@ -1935,7 +1936,7 @@ gotit:
swaplist_trim();
vput(sdp->swd_vp);
free(sdp->swd_path, M_VMSWAP, 0);
- free(sdp, M_VMSWAP, 0);
+ free(sdp, M_VMSWAP, sizeof(*sdp));
return;
}
}