From cb234d9f76760f64114ca80f5bcca58cbe5a4c46 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 11 Oct 2024 13:12:28 -0400 Subject: [PATCH] Fix casts when determining endpoint indices. Not everything got updated correctly when endpoint indices changed from uint8 to uint16. Fixes https://github.com/project-chip/connectedhomeip/issues/36007 --- src/app/util/attribute-storage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index 0d1b3827e8b365..adc728157c3a1e 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -255,7 +255,7 @@ uint16_t emberAfGetDynamicIndexFromEndpoint(EndpointId id) { if (emAfEndpoints[index].endpoint == id) { - return static_cast(index - FIXED_ENDPOINT_COUNT); + return static_cast(index - FIXED_ENDPOINT_COUNT); } } return kEmberInvalidEndpointIndex; @@ -322,7 +322,7 @@ EndpointId emberAfClearDynamicEndpoint(uint16_t index) { EndpointId ep = 0; - index = static_cast(index + FIXED_ENDPOINT_COUNT); + index = static_cast(index + FIXED_ENDPOINT_COUNT); if ((index < MAX_ENDPOINT_COUNT) && (emAfEndpoints[index].endpoint != kInvalidEndpointId) && (emberAfEndpointIndexIsEnabled(index)))