From d3ab93457784742bd95fc71e948dc3d3d5ffb48a Mon Sep 17 00:00:00 2001 From: mestre Date: Thu, 25 Mar 2021 16:23:39 +0000 Subject: [PATCH] an invalid value of `mcs' may come from the hardware so adjust code so that the value is only used after checking if it's valid or not. CID 1502921 OK stsp@ phessler@ --- sys/net80211/ieee80211_ra.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/net80211/ieee80211_ra.c b/sys/net80211/ieee80211_ra.c index 924e3008cf5..ec419b8e529 100644 --- a/sys/net80211/ieee80211_ra.c +++ b/sys/net80211/ieee80211_ra.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_ra.c,v 1.1 2021/03/12 16:26:27 stsp Exp $ */ +/* $OpenBSD: ieee80211_ra.c,v 1.2 2021/03/25 16:23:39 mestre Exp $ */ /* * Copyright (c) 2021 Christian Ehrhardt @@ -544,7 +544,7 @@ ieee80211_ra_add_stats_ht(struct ieee80211_ra_node *rn, static const uint64_t alpha = RA_FP_1 / 8; /* 1/8 = 0.125 */ static const uint64_t beta = RA_FP_1 / 4; /* 1/4 = 0.25 */ int s, sgi20; - struct ieee80211_ra_goodput_stats *g = &rn->g[mcs]; + struct ieee80211_ra_goodput_stats *g; uint64_t sfer, rate, delta; /* @@ -558,6 +558,7 @@ ieee80211_ra_add_stats_ht(struct ieee80211_ra_node *rn, s = splnet(); + g = &rn->g[mcs]; g->nprobe_pkts += total; g->nprobe_fail += fail; -- 2.20.1