From 99226734e207d62eb41e67098c21fec11e2383ac Mon Sep 17 00:00:00 2001 From: KonstantinKondrashov Date: Tue, 20 Oct 2020 22:12:28 +0800 Subject: [PATCH] esp_common: Fix range of MACs for interal usage with wrong crc Closes: https://github.com/espressif/esp-idf/issues/5937 --- components/esp_common/src/mac_addr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/esp_common/src/mac_addr.c b/components/esp_common/src/mac_addr.c index f441245de8..cd37a676b6 100644 --- a/components/esp_common/src/mac_addr.c +++ b/components/esp_common/src/mac_addr.c @@ -95,11 +95,9 @@ esp_err_t esp_efuse_mac_get_default(uint8_t* mac) // Small range of MAC addresses are accepted even if CRC is invalid. // These addresses are reserved for Espressif internal use. uint32_t mac_high = ((uint32_t)mac[0] << 8) | mac[1]; - if ((mac_high & 0xFFFF) == 0x18fe) { - uint32_t mac_low = ((uint32_t)mac[2] << 24) | ((uint32_t)mac[3] << 16) | ((uint32_t)mac[4] << 8) | mac[5]; - if ((mac_low >= 0x346a85c7) && (mac_low <= 0x346a85f8)) { - return ESP_OK; - } + uint32_t mac_low = ((uint32_t)mac[2] << 24) | ((uint32_t)mac[3] << 16) | ((uint32_t)mac[4] << 8) | mac[5]; + if (((mac_high & 0xFFFF) == 0x18fe) && (mac_low >= 0x346a85c7) && (mac_low <= 0x346a85f8)) { + return ESP_OK; } else { ESP_LOGE(TAG, "Base MAC address from BLK0 of EFUSE CRC error, efuse_crc = 0x%02x; calc_crc = 0x%02x", efuse_crc, calc_crc); abort();