Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 25c8c537 authored by Sunil Ravi's avatar Sunil Ravi
Browse files

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
parent 0286ec56
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1549,13 +1549,14 @@ wifi_error WifiLegacyHal::setIndoorState(bool isIndoor) {

std::pair<wifi_error, wifi_radio_combination_matrix*>
WifiLegacyHal::getSupportedRadioCombinationsMatrix() {
    std::array<char, kMaxSupportedRadioCombinationsMatrixLength> 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<wifi_radio_combination_matrix*>(buffer.data());
            reinterpret_cast<wifi_radio_combination_matrix*>(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};
}