Source-Changes-HG archive

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

[src/netbsd-9]: src/external/cddl/osnet/sys/kern Pull up following revision(s...



details:   https://anonhg.NetBSD.org/src/rev/06fb74f1cf88
branches:  netbsd-9
changeset: 368778:06fb74f1cf88
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Aug 03 15:54:23 2022 +0000

description:
Pull up following revision(s) (requested by riastradh in ticket #1494):

        external/cddl/osnet/sys/kern/kmem.c: revision 1.3

kmem_cache_create()'s "name" parameter can be on the stack,
so make a copy of it rather than keeping a pointer to it.

diffstat:

 external/cddl/osnet/sys/kern/kmem.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r d9fdfc88eb06 -r 06fb74f1cf88 external/cddl/osnet/sys/kern/kmem.c
--- a/external/cddl/osnet/sys/kern/kmem.c       Wed Aug 03 15:50:03 2022 +0000
+++ b/external/cddl/osnet/sys/kern/kmem.c       Wed Aug 03 15:54:23 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kmem.c,v 1.2 2019/05/23 08:32:30 hannken Exp $ */
+/*     $NetBSD: kmem.c,v 1.2.2.1 2022/08/03 15:54:23 martin Exp $      */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,6 +30,7 @@
 
 struct kmem_cache {
        pool_cache_t km_pool;
+       char km_name[32];
        void *km_private;
        int (*km_constructor)(void *, void *, int);
        void (*km_destructor)(void *, void *);
@@ -78,11 +79,12 @@
        KASSERT(vmp == NULL);
 
        km = kmem_zalloc(sizeof(*km), KM_SLEEP);
+       strlcpy(km->km_name, name, sizeof(km->km_name));
        km->km_private = private;
        km->km_constructor = constructor;
        km->km_destructor = destructor;
        km->km_reclaim = reclaim;
-       km->km_pool = pool_cache_init(bufsize, align, 0, 0, name, NULL,
+       km->km_pool = pool_cache_init(bufsize, align, 0, 0, km->km_name, NULL,
            IPL_NONE, solaris_constructor, solaris_destructor, km);
        if (km->km_pool == NULL) {
                kmem_free(km, sizeof(*km));



Home | Main Index | Thread Index | Old Index