Date: Tue, 22 Nov 2016 12:23:36 -0700 From: Ian Lepore <ian@freebsd.org> To: Adrian Chadd <adrian@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r309014 - head/sys/net80211 Message-ID: <1479842616.12501.43.camel@freebsd.org> In-Reply-To: <201611221736.uAMHaGZw054999@repo.freebsd.org> References: <201611221736.uAMHaGZw054999@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2016-11-22 at 17:36 +0000, Adrian Chadd wrote: > Author: adrian > Date: Tue Nov 22 17:36:16 2016 > New Revision: 309014 > URL: https://svnweb.freebsd.org/changeset/base/309014 > > Log: > [net80211] high oops on the high seas, or "god damnit compilers, > it's 2016 and you're supposed to save me from this." > It's the redundant parens that did you in. If it had been written if (rxs != NULL & (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP)) you would have been warned. I'm not quite sure how the compiler world standardized on "the presence of redundant parens means trust me I know what I'm doing," but that seems to be where we've landed in 2016. -- Ian > TODO: > > * drink real coffee before committing in the morning, or there's a > high > risk of more obviously self-evident commits being turned into > attempts > at humour. > > Reported by: cem, Coverity CID 1366219 > > Modified: > head/sys/net80211/ieee80211_crypto_ccmp.c > > Modified: head/sys/net80211/ieee80211_crypto_ccmp.c > ===================================================================== > ========= > --- head/sys/net80211/ieee80211_crypto_ccmp.c Tue Nov 22 > 17:14:09 2016 (r309013) > +++ head/sys/net80211/ieee80211_crypto_ccmp.c Tue Nov 22 > 17:36:16 2016 (r309014) > @@ -241,7 +241,7 @@ ccmp_decap(struct ieee80211_key *k, stru > > 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)) > goto finish; > > /* > @@ -286,7 +286,7 @@ finish: > /* > * Copy up 802.11 header and strip crypto bits. > */ > - if (! ((rxs != NULL) & (rxs->c_pktflags & > IEEE80211_RX_F_IV_STRIP))) { > + if (! ((rxs != NULL) && (rxs->c_pktflags & > IEEE80211_RX_F_IV_STRIP))) { > ovbcopy(mtod(m, void *), mtod(m, uint8_t *) + > ccmp.ic_header, > hdrlen); > m_adj(m, ccmp.ic_header); > @@ -295,13 +295,13 @@ finish: > /* > * XXX TODO: see if MMIC_STRIP also covers CCMP MIC trailer. > */ > - if (! ((rxs != NULL) & (rxs->c_pktflags & > IEEE80211_RX_F_MMIC_STRIP))) > + if (! ((rxs != NULL) && (rxs->c_pktflags & > IEEE80211_RX_F_MMIC_STRIP))) > 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))) { > k->wk_keyrsc[tid] = pn; > } > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1479842616.12501.43.camel>