Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netipsec Simplify; remove unnecessary zero-clears
details: https://anonhg.NetBSD.org/src/rev/0775b1b82723
branches: trunk
changeset: 355067:0775b1b82723
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Wed Jul 12 03:53:55 2017 +0000
description:
Simplify; remove unnecessary zero-clears
key_freesaval is used only when a target sav is being destroyed.
diffstat:
sys/netipsec/key.c | 33 ++++++++++-----------------------
1 files changed, 10 insertions(+), 23 deletions(-)
diffs (60 lines):
diff -r 141f20ab280b -r 0775b1b82723 sys/netipsec/key.c
--- a/sys/netipsec/key.c Wed Jul 12 01:57:43 2017 +0000
+++ b/sys/netipsec/key.c Wed Jul 12 03:53:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.176 2017/07/11 10:06:07 ozaki-r Exp $ */
+/* $NetBSD: key.c,v 1.177 2017/07/12 03:53:55 ozaki-r Exp $ */
/* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */
/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.176 2017/07/11 10:06:07 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.177 2017/07/12 03:53:55 ozaki-r Exp $");
/*
* This code is referd to RFC 2367
@@ -3099,33 +3099,20 @@
key_freesaval(struct secasvar *sav)
{
- if (sav->replay != NULL) {
+ KASSERT(sav->refcnt == 0);
+
+ if (sav->replay != NULL)
kmem_intr_free(sav->replay, sav->replay_len);
- sav->replay = NULL;
- sav->replay_len = 0;
- }
- if (sav->key_auth != NULL) {
+ if (sav->key_auth != NULL)
kmem_intr_free(sav->key_auth, sav->key_auth_len);
- sav->key_auth = NULL;
- sav->key_auth_len = 0;
- }
- if (sav->key_enc != NULL) {
+ if (sav->key_enc != NULL)
kmem_intr_free(sav->key_enc, sav->key_enc_len);
- sav->key_enc = NULL;
- sav->key_enc_len = 0;
- }
- if (sav->lft_c != NULL) {
+ if (sav->lft_c != NULL)
kmem_intr_free(sav->lft_c, sizeof(*(sav->lft_c)));
- sav->lft_c = NULL;
- }
- if (sav->lft_h != NULL) {
+ if (sav->lft_h != NULL)
kmem_intr_free(sav->lft_h, sizeof(*(sav->lft_h)));
- sav->lft_h = NULL;
- }
- if (sav->lft_s != NULL) {
+ if (sav->lft_s != NULL)
kmem_intr_free(sav->lft_s, sizeof(*(sav->lft_s)));
- sav->lft_s = NULL;
- }
}
/*
Home |
Main Index |
Thread Index |
Old Index