Skip to content

Commit c22571b

Browse files
Fix style + minor compile issues
1 parent 0583626 commit c22571b

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/app/util/attribute-storage.cpp

+21-15
Original file line numberDiff line numberDiff line change
@@ -292,23 +292,27 @@ CHIP_ERROR emberAfSetDynamicEndpoint(uint16_t index, EndpointId id, const EmberA
292292
}
293293
}
294294

295-
for (uint8_t i = 0; ep && (i < ep->clusterCount); i++) {
296-
if (!ep->cluster) {
295+
for (uint8_t i = 0; ep && (i < ep->clusterCount); i++)
296+
{
297+
if (!ep->cluster)
298+
{
297299
continue;
298300
}
299301

300302
const EmberAfCluster * cluster = &(ep->cluster[i]);
301-
if (!cluster->attributes) {
303+
if (!cluster->attributes)
304+
{
302305
continue;
303306
}
304307

305-
for (uint16_t j = 0; j < cluster->attributeCount; j++) {
308+
for (uint16_t j = 0; j < cluster->attributeCount; j++)
309+
{
306310
const EmberAfAttributeMetadata * attr = &(cluster->attributes[j]);
307-
if (emberAfAttributeSize(attr) > gEmberAttributeIOBufferSpan.size()) {
308-
ChipLogError(
309-
DataManagement,
310-
"Attribute %u (id=" ChipLogFormatMEI ") of Cluster %u (id=" ChipLogFormatMEI ") too large",
311-
j, ChipLogValueMEI(attr->attributeId), i, ChipLogValueMEI(cluster->clusterId));
311+
if (emberAfAttributeSize(attr) > chip::app::Compatibility::Internal::gEmberAttributeIOBufferSpan.size())
312+
{
313+
ChipLogError(DataManagement,
314+
"Attribute %u (id=" ChipLogFormatMEI ") of Cluster %u (id=" ChipLogFormatMEI ") too large", j,
315+
ChipLogValueMEI(attr->attributeId), i, ChipLogValueMEI(cluster->clusterId));
312316
return CHIP_ERROR_NO_MEMORY;
313317
}
314318
}
@@ -661,18 +665,20 @@ Status emAfReadOrWriteAttribute(const EmberAfAttributeSearchRecord * attRecord,
661665
// Is the attribute externally stored?
662666
if (am->mask & ATTRIBUTE_MASK_EXTERNAL_STORAGE)
663667
{
664-
if (write) {
665-
return emberAfExternalAttributeWriteCallback(attRecord->endpoint, attRecord->clusterId,
666-
am, buffer);
668+
if (write)
669+
{
670+
return emberAfExternalAttributeWriteCallback(attRecord->endpoint, attRecord->clusterId, am,
671+
buffer);
667672
}
668673

669-
if (readLength < emberAfAttributeSize(am)) {
674+
if (readLength < emberAfAttributeSize(am))
675+
{
670676
// Prevent a potential buffer overflow
671677
return Status::ResourceExhausted;
672678
}
673679

674-
return emberAfExternalAttributeReadCallback(attRecord->endpoint, attRecord->clusterId,
675-
am, buffer, emberAfAttributeSize(am));
680+
return emberAfExternalAttributeReadCallback(attRecord->endpoint, attRecord->clusterId, am,
681+
buffer, emberAfAttributeSize(am));
676682
}
677683

678684
// Internal storage is only supported for fixed endpoints

0 commit comments

Comments
 (0)