From a1a2fcda1eb9130ae110acc1a6d5c055806886e2 Mon Sep 17 00:00:00 2001 From: itojun Date: Mon, 25 Nov 2002 08:31:58 +0000 Subject: [PATCH] no need for error check after MEXTMALLOC - jdolecek --- sys/kern/kern_malloc_debug.c | 9 +++++++-- sys/kern/uipc_syscalls.c | 8 ++------ sys/kern/uipc_usrreq.c | 14 ++++---------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/sys/kern/kern_malloc_debug.c b/sys/kern/kern_malloc_debug.c index 6082553d0974..4a366f803f9c 100644 --- a/sys/kern/kern_malloc_debug.c +++ b/sys/kern/kern_malloc_debug.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_malloc_debug.c,v 1.7 2002/08/14 15:21:31 thorpej Exp $ */ +/* $NetBSD: kern_malloc_debug.c,v 1.8 2002/11/25 08:31:58 itojun Exp $ */ /* * Copyright (c) 1999, 2000 Artur Grabowski @@ -56,7 +56,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_malloc_debug.c,v 1.7 2002/08/14 15:21:31 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_malloc_debug.c,v 1.8 2002/11/25 08:31:58 itojun Exp $"); #include #include @@ -80,8 +80,13 @@ __KERNEL_RCSID(0, "$NetBSD: kern_malloc_debug.c,v 1.7 2002/08/14 15:21:31 thorpe * if any memory chunks of this type are used. It's ok to change the size * in runtime. */ +#if 1 int debug_malloc_type = -1; int debug_malloc_size = -1; +#else +int debug_malloc_type = M_UVMAMAP; +int debug_malloc_size = 0; +#endif int debug_malloc_size_lo = -1; int debug_malloc_size_hi = -1; diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index a0b2ce99c0e2..79a25fe9b3ff 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_syscalls.c,v 1.72 2002/11/25 06:32:37 itojun Exp $ */ +/* $NetBSD: uipc_syscalls.c,v 1.73 2002/11/25 08:31:59 itojun Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1990, 1993 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.72 2002/11/25 06:32:37 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.73 2002/11/25 08:31:59 itojun Exp $"); #include "opt_ktrace.h" #include "opt_pipe.h" @@ -1035,10 +1035,6 @@ sockargs(struct mbuf **mp, const void *buf, size_t buflen, int type) * enough external storage to hold the argument. */ MEXTMALLOC(m, buflen, M_WAITOK); - if ((m->m_flags & M_EXT) == 0) { - m_free(m); - return (ENOBUFS); - } } m->m_len = buflen; error = copyin(buf, mtod(m, caddr_t), buflen); diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index ea83bc63f760..7865ee709fb9 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_usrreq.c,v 1.55 2002/11/25 06:32:38 itojun Exp $ */ +/* $NetBSD: uipc_usrreq.c,v 1.56 2002/11/25 08:32:00 itojun Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.55 2002/11/25 06:32:38 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.56 2002/11/25 08:32:00 itojun Exp $"); #include #include @@ -144,11 +144,8 @@ unp_setsockaddr(unp, nam) else sun = &sun_noname; nam->m_len = sun->sun_len; - if (nam->m_len > MLEN) { + if (nam->m_len > MLEN) MEXTMALLOC(nam, nam->m_len, M_WAITOK); - if ((nam->m_flags & M_EXT) == 0) - panic("MEXTMALLOC with too big size"); - } memcpy(mtod(nam, caddr_t), sun, (size_t)nam->m_len); } @@ -164,11 +161,8 @@ unp_setpeeraddr(unp, nam) else sun = &sun_noname; nam->m_len = sun->sun_len; - if (nam->m_len > MLEN) { + if (nam->m_len > MLEN) MEXTMALLOC(nam, nam->m_len, M_WAITOK); - if ((nam->m_flags & M_EXT) == 0) - panic("MEXTMALLOC with too big size"); - } memcpy(mtod(nam, caddr_t), sun, (size_t)nam->m_len); }