From owner-svn-src-head@freebsd.org Tue Nov 22 19:23:45 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93B74C50896 for ; Tue, 22 Nov 2016 19:23:45 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 799821EB0 for ; Tue, 22 Nov 2016 19:23:45 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 2f403a83-b0e9-11e6-94b7-cbe6054a74b1 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 2f403a83-b0e9-11e6-94b7-cbe6054a74b1; Tue, 22 Nov 2016 19:23:45 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id uAMJNaII001717; Tue, 22 Nov 2016 12:23:36 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1479842616.12501.43.camel@freebsd.org> Subject: Re: svn commit: r309014 - head/sys/net80211 From: Ian Lepore To: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 22 Nov 2016 12:23:36 -0700 In-Reply-To: <201611221736.uAMHaGZw054999@repo.freebsd.org> References: <201611221736.uAMHaGZw054999@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2016 19:23:45 -0000 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; >   } >   >