diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c index e10193a95de9..eb59603cd0ce 100644 --- a/core/wma/src/wma_utils.c +++ b/core/wma/src/wma_utils.c @@ -767,9 +767,12 @@ static tSirLLStatsResults *wma_get_ll_stats_ext_buf(uint32_t *len, (sizeof(struct sir_wifi_tx) + sizeof(struct sir_wifi_rx))); } - if (peer_num > (WMI_SVC_MSG_MAX_SIZE / - (sizeof(struct sir_wifi_ll_ext_peer_stats) + - total_peer_len))) { + if (total_peer_len > WMI_SVC_MSG_MAX_SIZE) { + excess_data = true; + break; + } + if (peer_num > (WMI_SVC_MSG_MAX_SIZE - total_peer_len) / + sizeof(struct sir_wifi_ll_ext_peer_stats)) { excess_data = true; break; } else {