diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-05-09 10:51:01 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-05-09 17:51:59 +0000 |
commit | 09209056ce0fd4ef0a4f5ac1ccc2fa1b12bba49c (patch) | |
tree | 172c337e12796bd56dfbd960865d81dcec9c3a9d | |
parent | 2d44f7f3035fd6b44b413d2f2a741686d8c190f3 (diff) | |
download | wireshark-09209056ce0fd4ef0a4f5ac1ccc2fa1b12bba49c.tar.gz |
Set nss and rate_mcs_index in more arms of the Series II PLCP switch.
For HT mixed, set it the same way it's set for HT greenfield.
For pre-HT, set it to 0.
Also, for the "unknown" case, set rate_mcs_index to 0.
This should obviate the need to initialize either of those variables,
don't initialize them, so that failing to set them in an arm of the
switch statement shows up as an error if the compiler's dataflow
analysis actually bothers to check this.
Change-Id: I92703770dd5000a579b53609fb93a2085fd9fca3
Reviewed-on: https://code.wireshark.org/review/21573
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | wiretap/vwr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/wiretap/vwr.c b/wiretap/vwr.c index 941ab8e330..015a7a0205 100644 --- a/wiretap/vwr.c +++ b/wiretap/vwr.c @@ -1412,7 +1412,7 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, int bytes_written = 0; /* bytes output to buf so far */ const guint8 *s_start_ptr,*s_trail_ptr, *plcp_ptr, *m_ptr; /* stats & MPDU ptr */ guint32 msdu_length, actual_octets; /* octets in frame */ - guint8 l1p_1,l1p_2, plcp_type, rate_mcs_index = 0, nss = 0; /* mod (CCK-L/CCK-S/OFDM) */ + guint8 l1p_1, l1p_2, plcp_type, rate_mcs_index, nss; /* mod (CCK-L/CCK-S/OFDM) */ guint flow_seq; guint64 s_time = LL_ZERO, e_time = LL_ZERO; /* start/end */ /* times, nsec */ @@ -1545,6 +1545,7 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, chanflags |= CHAN_OFDM; } rate = get_legacy_rate(rate_mcs_index); + nss = 0; break; case vVW510021_W_PLCP_MIXED: @@ -1565,8 +1566,8 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, radioflags |= FLAGS_CHAN_HT | ((plcp_ptr[3] & 0x80) ? FLAGS_CHAN_40MHZ : 0) | ((l1p_1 & vVW510021_W_IS_LONGGI) ? 0 : FLAGS_CHAN_SHORTGI); chanflags |= CHAN_OFDM; + nss = (rate_mcs_index < MAX_HT_MCS) ? nss_for_mcs[rate_mcs_index] : 0; rate = get_ht_rate(rate_mcs_index, radioflags); - nss = 0; break; case vVW510021_W_PLCP_GREENFIELD: @@ -1615,6 +1616,7 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr, break; default: + rate_mcs_index = 0; nss = 0; rate = 0.0f; break; |