Source-Changes-HG archive

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

[src/trunk]: src/sys/net80211 Convert malloc -> kmem.



details:   https://anonhg.NetBSD.org/src/rev/257f9fead5d0
branches:  trunk
changeset: 974143:257f9fead5d0
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jul 25 22:27:05 2020 +0000

description:
Convert malloc -> kmem.

Switch order of members for better alignment.  Sort includes.

diffstat:

 sys/net80211/ieee80211_crypto_ccmp.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (60 lines):

diff -r 850069c6ef2e -r 257f9fead5d0 sys/net80211/ieee80211_crypto_ccmp.c
--- a/sys/net80211/ieee80211_crypto_ccmp.c      Sat Jul 25 22:26:59 2020 +0000
+++ b/sys/net80211/ieee80211_crypto_ccmp.c      Sat Jul 25 22:27:05 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieee80211_crypto_ccmp.c,v 1.16 2020/07/25 22:26:23 riastradh Exp $     */
+/*     $NetBSD: ieee80211_crypto_ccmp.c,v 1.17 2020/07/25 22:27:05 riastradh Exp $     */
 
 /*
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto_ccmp.c,v 1.7 2005/07/11 03:06:23 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_ccmp.c,v 1.16 2020/07/25 22:26:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_ccmp.c,v 1.17 2020/07/25 22:27:05 riastradh Exp $");
 #endif
 
 /*
@@ -47,10 +47,10 @@
  * its license is included below.
  */
 #include <sys/param.h>
-#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/kmem.h>
 #include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
+#include <sys/systm.h>
 
 #include <sys/socket.h>
 
@@ -67,8 +67,8 @@
 #define AES_BLOCK_LEN 16
 
 struct ccmp_ctx {
+       struct aesenc cc_aes;
        struct ieee80211com *cc_ic;     /* for diagnostics */
-       struct aesenc cc_aes;
 };
 
 static void *ccmp_attach(struct ieee80211com *, struct ieee80211_key *);
@@ -106,7 +106,7 @@
 {
        struct ccmp_ctx *ctx;
 
-       ctx = malloc(sizeof(struct ccmp_ctx), M_DEVBUF, M_NOWAIT | M_ZERO);
+       ctx = kmem_zalloc(sizeof(*ctx), KM_NOSLEEP);
        if (ctx == NULL) {
                ic->ic_stats.is_crypto_nomem++;
                return NULL;
@@ -120,7 +120,7 @@
 {
        struct ccmp_ctx *ctx = k->wk_private;
 
-       free(ctx, M_DEVBUF);
+       kmem_free(ctx, sizeof(*ctx));
 }
 
 static int



Home | Main Index | Thread Index | Old Index