Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net80211 Style, and check the return value of m_append.
details: https://anonhg.NetBSD.org/src/rev/df19f1970dbd
branches: trunk
changeset: 358839:df19f1970dbd
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Jan 19 07:57:50 2018 +0000
description:
Style, and check the return value of m_append.
diffstat:
sys/net80211/ieee80211_crypto_tkip.c | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
diffs (84 lines):
diff -r 949c95bac7cb -r df19f1970dbd sys/net80211/ieee80211_crypto_tkip.c
--- a/sys/net80211/ieee80211_crypto_tkip.c Fri Jan 19 07:53:46 2018 +0000
+++ b/sys/net80211/ieee80211_crypto_tkip.c Fri Jan 19 07:57:50 2018 +0000
@@ -1,4 +1,6 @@
-/*-
+/* $NetBSD: ieee80211_crypto_tkip.c,v 1.14 2018/01/19 07:57:50 maxv Exp $ */
+
+/*
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
* All rights reserved.
*
@@ -34,7 +36,7 @@
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_crypto_tkip.c,v 1.10 2005/08/08 18:46:35 sam Exp $");
#endif
#ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_tkip.c,v 1.13 2018/01/17 17:41:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_crypto_tkip.c,v 1.14 2018/01/19 07:57:50 maxv Exp $");
#endif
/*
@@ -45,8 +47,8 @@
* its license is included below.
*/
#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/endian.h>
@@ -328,7 +330,7 @@
ic->ic_stats.is_crypto_tkipdemic++;
- michael_mic(ctx, k->wk_rxmic,
+ michael_mic(ctx, k->wk_rxmic,
m, hdrlen, m->m_pkthdr.len - (hdrlen + tkip.ic_miclen),
mic);
m_copydata(m, m->m_pkthdr.len - tkip.ic_miclen,
@@ -885,17 +887,21 @@
ctx->tx_phase1_done = 1;
}
tkip_mixing_phase2(ctx->tx_rc4key, key->wk_key, ctx->tx_ttak,
- (u16) key->wk_keytsc);
+ (u16)key->wk_keytsc);
wep_encrypt(ctx->tx_rc4key,
m, hdrlen + tkip.ic_header,
m->m_pkthdr.len - (hdrlen + tkip.ic_header),
icv);
- (void) m_append(m, IEEE80211_WEP_CRCLEN, icv); /* XXX check return */
+
+ if (!m_append(m, IEEE80211_WEP_CRCLEN, icv)) {
+ return 0;
+ }
key->wk_keytsc++;
if ((u16)(key->wk_keytsc) == 0)
ctx->tx_phase1_done = 0;
+
return 1;
}
@@ -922,9 +928,8 @@
tkip_mixing_phase2(ctx->rx_rc4key, key->wk_key, ctx->rx_ttak, iv16);
/* NB: m is unstripped; deduct headers + ICV to get payload */
- if (wep_decrypt(ctx->rx_rc4key,
- m, hdrlen + tkip.ic_header,
- m->m_pkthdr.len - (hdrlen + tkip.ic_header + tkip.ic_trailer))) {
+ if (wep_decrypt(ctx->rx_rc4key, m, hdrlen + tkip.ic_header,
+ m->m_pkthdr.len - (hdrlen + tkip.ic_header + tkip.ic_trailer))) {
if (iv32 != (u32)(key->wk_keyrsc >> 16)) {
/* Previously cached Phase1 result was already lost, so
* it needs to be recalculated for the next packet. */
@@ -936,6 +941,7 @@
ctx->tc_ic->ic_stats.is_rx_tkipicv++;
return 0;
}
+
return 1;
}
Home |
Main Index |
Thread Index |
Old Index