Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern KASSERT -> panic



details:   https://anonhg.NetBSD.org/src/rev/ff3c2bf3f73e
branches:  trunk
changeset: 932731:ff3c2bf3f73e
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu May 14 17:01:34 2020 +0000

description:
KASSERT -> panic

diffstat:

 sys/kern/subr_kmem.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 7d05327ab0df -r ff3c2bf3f73e sys/kern/subr_kmem.c
--- a/sys/kern/subr_kmem.c      Thu May 14 16:57:53 2020 +0000
+++ b/sys/kern/subr_kmem.c      Thu May 14 17:01:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_kmem.c,v 1.79 2020/03/08 00:31:19 ad Exp $        */
+/*     $NetBSD: subr_kmem.c,v 1.80 2020/05/14 17:01:34 maxv Exp $      */
 
 /*
  * Copyright (c) 2009-2020 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.79 2020/03/08 00:31:19 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.80 2020/05/14 17:01:34 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kmem.h"
@@ -258,7 +258,9 @@
        pool_cache_t pc;
 
        KASSERT(p != NULL);
-       KASSERT(requested_size > 0);
+       if (__predict_false(requested_size == 0)) {
+               panic("%s: zero size with pointer %p", __func__, p);
+       }
 
        kasan_add_redzone(&requested_size);
        size = kmem_roundup_size(requested_size);



Home | Main Index | Thread Index | Old Index