Compute the pointer earlier, not in the return statement. No functional

change.
This commit is contained in:
maxv 2018-08-20 11:46:44 +00:00
parent 312ff3500a
commit b120dbba69
2 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_malloc.c,v 1.146 2017/07/28 12:28:48 martin Exp $ */ /* $NetBSD: kern_malloc.c,v 1.147 2018/08/20 11:46:44 maxv Exp $ */
/* /*
* Copyright (c) 1987, 1991, 1993 * Copyright (c) 1987, 1991, 1993
@ -70,7 +70,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.146 2017/07/28 12:28:48 martin Exp $"); __KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.147 2018/08/20 11:46:44 maxv Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/malloc.h> #include <sys/malloc.h>
@ -124,8 +124,9 @@ kern_malloc(unsigned long size, int flags)
} }
mh = (void *)((char *)p + hdroffset); mh = (void *)((char *)p + hdroffset);
mh->mh_size = allocsize - hdroffset; mh->mh_size = allocsize - hdroffset;
mh++;
return mh + 1; return mh;
} }
void void

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_kmem.c,v 1.67 2018/08/20 11:35:28 maxv Exp $ */ /* $NetBSD: subr_kmem.c,v 1.68 2018/08/20 11:46:44 maxv Exp $ */
/*- /*-
* Copyright (c) 2009-2015 The NetBSD Foundation, Inc. * Copyright (c) 2009-2015 The NetBSD Foundation, Inc.
@ -92,7 +92,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.67 2018/08/20 11:35:28 maxv Exp $"); __KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.68 2018/08/20 11:46:44 maxv Exp $");
#ifdef _KERNEL_OPT #ifdef _KERNEL_OPT
#include "opt_kmem.h" #include "opt_kmem.h"
@ -265,8 +265,9 @@ kmem_intr_alloc(size_t requested_size, km_flag_t kmflags)
if (__predict_true(p != NULL)) { if (__predict_true(p != NULL)) {
FREECHECK_OUT(&kmem_freecheck, p); FREECHECK_OUT(&kmem_freecheck, p);
kmem_size_set(p, requested_size); kmem_size_set(p, requested_size);
p += SIZE_SIZE;
return p + SIZE_SIZE; return p;
} }
return p; return p;
} }