From 25c8c53725077d44607036f7da7d63854b829654 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Wed, 6 Apr 2022 05:05:14 -0700 Subject: [PATCH] wifi: Fix for returning wrong radio combinations matrix Allocate memory in heap for carrying radio combinations matrix from driver/firmware to wifi HAL. Bug: 225764376 Bug: 225762955 Test: atest WifiChipHidlTest Change-Id: I1049f7ab9f16a35a87b7cda34ba31797fde046e3 --- wifi/1.6/default/wifi_legacy_hal.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wifi/1.6/default/wifi_legacy_hal.cpp b/wifi/1.6/default/wifi_legacy_hal.cpp index 8a75fd83e3..bb8cf590d9 100644 --- a/wifi/1.6/default/wifi_legacy_hal.cpp +++ b/wifi/1.6/default/wifi_legacy_hal.cpp @@ -1549,13 +1549,14 @@ wifi_error WifiLegacyHal::setIndoorState(bool isIndoor) { std::pair WifiLegacyHal::getSupportedRadioCombinationsMatrix() { - std::array buffer; - buffer.fill(0); + char* buffer = new char[kMaxSupportedRadioCombinationsMatrixLength]; + std::fill(buffer, buffer + kMaxSupportedRadioCombinationsMatrixLength, 0); uint32_t size = 0; wifi_radio_combination_matrix* radio_combination_matrix_ptr = - reinterpret_cast(buffer.data()); + reinterpret_cast(buffer); wifi_error status = global_func_table_.wifi_get_supported_radio_combinations_matrix( - global_handle_, buffer.size(), &size, radio_combination_matrix_ptr); + global_handle_, kMaxSupportedRadioCombinationsMatrixLength, &size, + radio_combination_matrix_ptr); CHECK(size >= 0 && size <= kMaxSupportedRadioCombinationsMatrixLength); return {status, radio_combination_matrix_ptr}; }