Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Fix "how" argument of MGET(). Pointed o...
details: https://anonhg.NetBSD.org/src/rev/f1f13fd0bc47
branches: trunk
changeset: 318490:f1f13fd0bc47
user: knakahara <knakahara%NetBSD.org@localhost>
date: Fri Apr 27 00:06:40 2018 +0000
description:
Fix "how" argument of MGET(). Pointed out by maxv@n.o, thanks.
MGET() does not have M_ZERO flag, so add memset when it is required.
diffstat:
sys/net/if_ipsec.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diffs (62 lines):
diff -r 832a67a67c9f -r f1f13fd0bc47 sys/net/if_ipsec.c
--- a/sys/net/if_ipsec.c Thu Apr 26 20:10:44 2018 +0000
+++ b/sys/net/if_ipsec.c Fri Apr 27 00:06:40 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ipsec.c,v 1.11 2018/04/06 10:38:53 knakahara Exp $ */
+/* $NetBSD: if_ipsec.c,v 1.12 2018/04/27 00:06:40 knakahara Exp $ */
/*
* Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.11 2018/04/06 10:38:53 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.12 2018/04/27 00:06:40 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1339,10 +1339,11 @@
{
struct mbuf *m;
- MGET(m, M_WAITOK | M_ZERO, MT_DATA);
- if (align)
+ MGET(m, M_WAIT, MT_DATA);
+ if (align) {
m->m_len = PFKEY_ALIGN8(len);
- else
+ memset(mtod(m, void *), 0, m->m_len);
+ } else
m->m_len = len;
m_copyback(m, 0, len, data);
m_cat(m0, m);
@@ -1378,8 +1379,9 @@
if (len == 0)
return;
- MGET(m, M_WAITOK | M_ZERO, MT_DATA);
+ MGET(m, M_WAIT, MT_DATA);
m->m_len = len;
+ memset(mtod(m, void *), 0, m->m_len);
m_cat(m0, m);
}
@@ -1556,7 +1558,7 @@
memset(&xpl, 0, sizeof(xpl));
memset(&xisr, 0, sizeof(xisr));
- MGETHDR(m, M_WAITOK, MT_DATA);
+ MGETHDR(m, M_WAIT, MT_DATA);
size = if_ipsec_set_sadb_src(&xsrc, src, proto);
ext_msg_len += PFKEY_UNIT64(size);
@@ -1683,7 +1685,7 @@
memset(&msg, 0, sizeof(msg));
memset(&xpl, 0, sizeof(xpl));
- MGETHDR(m, M_WAITOK, MT_DATA);
+ MGETHDR(m, M_WAIT, MT_DATA);
size = if_ipsec_set_sadb_x_policy(&xpl, NULL, 0, 0, sp->id, 0, NULL, NULL);
ext_msg_len += PFKEY_UNIT64(size);
Home |
Main Index |
Thread Index |
Old Index