Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Dec 2020 17:27:25 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r368450 - head/sys/dev/ath
Message-ID:  <202012081727.0B8HRPoV055555@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Tue Dec  8 17:27:24 2020
New Revision: 368450
URL: https://svnweb.freebsd.org/changeset/base/368450

Log:
  [ath] Don't use hard-coded values in the sanity check.
  
  Don't use hard-coded values in the phy error and receive antenna
  checks.

Modified:
  head/sys/dev/ath/if_ath_rx.c

Modified: head/sys/dev/ath/if_ath_rx.c
==============================================================================
--- head/sys/dev/ath/if_ath_rx.c	Tue Dec  8 17:25:59 2020	(r368449)
+++ head/sys/dev/ath/if_ath_rx.c	Tue Dec  8 17:27:24 2020	(r368450)
@@ -706,8 +706,11 @@ ath_rx_pkt(struct ath_softc *sc, struct ath_rx_status 
 				ath_dfs_process_phy_err(sc, m, rstamp, rs);
 			}
 
-			/* Be suitably paranoid about receiving phy errors out of the stats array bounds */
-			if (rs->rs_phyerr < 64)
+			/*
+			 * Be suitably paranoid about receiving phy errors
+			 * out of the stats array bounds
+			 */
+			if (rs->rs_phyerr < ATH_IOCTL_STATS_NUM_RX_PHYERR)
 				sc->sc_stats.ast_rx_phy[rs->rs_phyerr]++;
 			goto rx_error;	/* NB: don't count in ierrors */
 		}
@@ -835,7 +838,7 @@ rx_accept:
 	 * the majority of the statistics are only valid
 	 * for the last frame in an aggregate.
 	 */
-	if (rs->rs_antenna > 7) {
+	if (rs->rs_antenna >= ATH_IOCTL_STATS_NUM_RX_ANTENNA) {
 		device_printf(sc->sc_dev, "%s: rs_antenna > 7 (%d)\n",
 		    __func__, rs->rs_antenna);
 #ifdef	ATH_DEBUG



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012081727.0B8HRPoV055555>