Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Clobber the size when freeing a buffer. This way, i...
details: https://anonhg.NetBSD.org/src/rev/7618eec6ab0d
branches: trunk
changeset: 448531:7618eec6ab0d
user: maxv <maxv%NetBSD.org@localhost>
date: Mon Feb 04 15:13:54 2019 +0000
description:
Clobber the size when freeing a buffer. This way, if the same buffer gets
freed twice, the second size check will fire.
diffstat:
sys/kern/subr_kmem.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (27 lines):
diff -r f3e38751576f -r 7618eec6ab0d sys/kern/subr_kmem.c
--- a/sys/kern/subr_kmem.c Mon Feb 04 15:07:34 2019 +0000
+++ b/sys/kern/subr_kmem.c Mon Feb 04 15:13:54 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_kmem.c,v 1.72 2018/12/23 12:15:01 maxv Exp $ */
+/* $NetBSD: subr_kmem.c,v 1.73 2019/02/04 15:13:54 maxv Exp $ */
/*-
* Copyright (c) 2009-2015 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.72 2018/12/23 12:15:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.73 2019/02/04 15:13:54 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_kmem.h"
@@ -549,6 +549,8 @@
panic("kmem_free(%p, %zu) != allocated size %zu",
(const uint8_t *)p + SIZE_SIZE, sz, hsz);
}
+
+ hd->size = -1;
}
#endif /* defined(KMEM_SIZE) */
Home |
Main Index |
Thread Index |
Old Index