Skip to content

Commit 1259118

Browse files
andy31415tennessee-googlerestyled-commitsandreilitvin
authored andcommitted
Add missed code review comments (#28626)
* Fix KeySetRemove to fail on key set index 0 Problem: - Removing KeySet index 0 is not allowed by spec, but SDK allowed it. - Checking that we ran without accessing fabric is not done, so error is FAILURE instead of UNSUPPORTED_ACCESS. - Fixes #28518 This PR: - Adds the check and tests against removing fabric index zero - Improves error reporting for several errors in the cluster - Combines validation logic for accessing fabric that was missing Testing: - Added unit tests and integration tests for additions (except for the unsupported access that requires PASE to check) * Regen tests with ZAP * Restyled by clang-format * Remove explicit check for undefined fabric index * Fix build * Rename ValidateAndGetProviderAndFabric to just GetProviderAndFabric * Added back cleanup for VerifyOrDie argument checking * Restyle * Update based on code review comments * Remove two more flight check comments * Restyle * Fix merge error --------- Co-authored-by: [email protected] <[email protected]> Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Andrei Litvin <[email protected]>
1 parent 629d961 commit 1259118

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/app/CommandHandler.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,15 @@ void CommandHandler::AddStatusAndLogIfFailure(const ConcreteCommandPath & aComma
484484
ChipLogValueIMStatus(aStatus), aMessage);
485485
}
486486

487-
LogErrorOnFailure(AddStatus(aCommandPath, aStatus));
487+
CHIP_ERROR err = AddStatus(aCommandPath, aStatus);
488+
if (err != CHIP_NO_ERROR)
489+
{
490+
ChipLogError(DataManagement,
491+
"Failed to set status on Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI
492+
": %" CHIP_ERROR_FORMAT,
493+
aCommandPath.mEndpointId, ChipLogValueMEI(aCommandPath.mClusterId), ChipLogValueMEI(aCommandPath.mCommandId),
494+
err.Format());
495+
}
488496
}
489497

490498
CHIP_ERROR CommandHandler::AddClusterSpecificSuccess(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus)

src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ bool emberAfGroupKeyManagementClusterKeySetWriteCallback(
450450
Credentials::GroupDataProvider * provider = nullptr;
451451
const FabricInfo * fabric = nullptr;
452452

453-
// Flight-check fabric scoping.
454453
if (!GetProviderAndFabric(commandObj, commandPath, &provider, &fabric))
455454
{
456455
// Command will already have status populated from validation.
@@ -555,7 +554,6 @@ bool emberAfGroupKeyManagementClusterKeySetReadCallback(
555554
Credentials::GroupDataProvider * provider = nullptr;
556555
const FabricInfo * fabric = nullptr;
557556

558-
// Flight-check fabric scoping.
559557
if (!GetProviderAndFabric(commandObj, commandPath, &provider, &fabric))
560558
{
561559
// Command will already have status populated from validation.
@@ -621,7 +619,6 @@ bool emberAfGroupKeyManagementClusterKeySetRemoveCallback(
621619
Credentials::GroupDataProvider * provider = nullptr;
622620
const FabricInfo * fabric = nullptr;
623621

624-
// Flight-check fabric scoping.
625622
if (!GetProviderAndFabric(commandObj, commandPath, &provider, &fabric))
626623
{
627624
// Command will already have status populated from validation.
@@ -694,7 +691,6 @@ bool emberAfGroupKeyManagementClusterKeySetReadAllIndicesCallback(
694691
Credentials::GroupDataProvider * provider = nullptr;
695692
const FabricInfo * fabric = nullptr;
696693

697-
// Flight-check fabric scoping.
698694
if (!GetProviderAndFabric(commandObj, commandPath, &provider, &fabric))
699695
{
700696
// Command will already have status populated from validation.

0 commit comments

Comments
 (0)