Date: Thu, 20 Feb 2025 18:05:26 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 8dcdffdb0861 - main - net80211: crypto: ccmp: simplify and style(9) Message-ID: <202502201805.51KI5Q5j088065@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=8dcdffdb086103e9ce36bfa82fc1179c88ebc31b commit 8dcdffdb086103e9ce36bfa82fc1179c88ebc31b Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2025-01-27 13:54:02 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2025-02-20 18:05:00 +0000 net80211: crypto: ccmp: simplify and style(9) Comply with style(9) and andd checks for booleaness when doing bit tests. If there is no need for double negated checks simplify them. This all makes the conditions a lot easier to read. Slip in a comment about MIC vs. MMIC. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste, adrian Differential Revision: https://reviews.freebsd.org/D49055 --- sys/net80211/ieee80211_crypto_ccmp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/net80211/ieee80211_crypto_ccmp.c b/sys/net80211/ieee80211_crypto_ccmp.c index 06028cf2a37c..404996b1cbca 100644 --- a/sys/net80211/ieee80211_crypto_ccmp.c +++ b/sys/net80211/ieee80211_crypto_ccmp.c @@ -242,7 +242,7 @@ ccmp_decap(struct ieee80211_key *k, struct mbuf *m, int hdrlen) rxs = ieee80211_get_rx_params_ptr(m); - if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP)) + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP) != 0) goto finish; /* @@ -297,14 +297,15 @@ finish: /* * XXX TODO: see if MMIC_STRIP also covers CCMP MIC trailer. + * Well no as it's a MIC not MMIC but we re-use the same flag for now. */ - if (! ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_MMIC_STRIP))) + if ((rxs == NULL) || (rxs->c_pktflags & IEEE80211_RX_F_MMIC_STRIP) == 0) m_adj(m, -ccmp.ic_trailer); /* * Ok to update rsc now. */ - if (! ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP))) { + if ((rxs == NULL) || (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP) == 0) { /* * Do not go backwards in the IEEE80211_KEY_NOREPLAY cases * or in case hardware has checked but frames are arriving
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502201805.51KI5Q5j088065>