Skip to content

Commit 0b4c3a7

Browse files
authored
[MSAN fix] FabricEntryData::Find() + UDCClientState (project-chip#71809)
1 parent 3038001 commit 0b4c3a7

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/app/storage/FabricTableImpl.ipp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,10 @@ struct FabricEntryData : public PersistableData<kFabricMaxBytes>
322322
}
323323

324324
/// @brief Finds the index where the current entry should be inserted by going through the endpoint's table and checking
325-
/// whether the entry is already there. If the target is not in the table, sets idx to the first empty space
326-
/// @param target_entry StorageId of entry to find
327-
/// @param idx Index where target or space is found
325+
/// whether the entry is already there. If the target is not in the table, sets idx to the first empty space.
326+
/// If the target was not found and the table is full, sets idx to kUndefinedEntryIndex.
327+
/// @param[in] target_entry StorageId of entry to find
328+
/// @param[out] idx Index where target or space is found.
328329
/// @return CHIP_NO_ERROR if managed to find the target entry, CHIP_ERROR_NOT_FOUND if not found and space left
329330
/// CHIP_ERROR_NO_MEMORY if target was not found and table is full
330331
CHIP_ERROR Find(const StorageId & target_entry, EntryIndex & idx)
@@ -351,7 +352,7 @@ struct FabricEntryData : public PersistableData<kFabricMaxBytes>
351352
idx = firstFreeIdx;
352353
return CHIP_ERROR_NOT_FOUND;
353354
}
354-
355+
idx = Data::kUndefinedEntryIndex;
355356
return CHIP_ERROR_NO_MEMORY;
356357
}
357358

@@ -360,8 +361,8 @@ struct FabricEntryData : public PersistableData<kFabricMaxBytes>
360361
CHIP_ERROR err = CHIP_NO_ERROR;
361362
// Look for empty storage space
362363

363-
EntryIndex index;
364-
err = this->Find(id, index);
364+
EntryIndex index = Data::kUndefinedEntryIndex;
365+
err = this->Find(id, index);
365366

366367
// C++ doesn't have const constructors; variable is declared const
367368
const TypedTableEntryData entry(endpoint_id, fabric_index, const_cast<StorageId &>(id), const_cast<StorageData &>(data),

src/protocols/user_directed_commissioning/UDCClientState.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ class UDCClientState
241241
bool mCancelPasscode = false;
242242
uint8_t mPasscodeLength = 0;
243243

244-
UDCClientProcessingState mUDCClientProcessingState;
245-
System::Clock::Timestamp mExpirationTime = System::Clock::kZero;
244+
UDCClientProcessingState mUDCClientProcessingState = UDCClientProcessingState::kNotInitialized;
245+
System::Clock::Timestamp mExpirationTime = System::Clock::kZero;
246246

247247
uint32_t mCachedCommissionerPasscode = 0;
248248
};

0 commit comments

Comments
 (0)