[Code Driven Cluster] Decouple Fan Cluster part 2#43408
[Code Driven Cluster] Decouple Fan Cluster part 2#43408LyudmilaKostanyan wants to merge 180 commits into
Fan Cluster part 2#43408Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a solid step forward in migrating the Fan Control cluster to a modern, code-driven architecture. However, a critical use-after-free vulnerability has been identified in the integration layer where stack-allocated delegates are passed to registration functions, which violates the rule regarding the lifetime of stack-allocated objects passed by reference. Beyond this, the FeatureMap attribute is hardcoded to zero, and key configuration attributes like SpeedMax, RockSupport, and WindSupport are hardcoded in CodegenIntegration.cpp, limiting customization. Logic errors were also found in the attribute write validation for FanMode, RockSetting, and WindSetting, potentially causing incorrect device behavior or denial of service. Addressing these points, including expanding unit tests for FeatureMap once corrected, is essential for a secure, correct, and flexible implementation.
There was a problem hiding this comment.
Code Review
This pull request successfully migrates the Fan Control cluster to the code-driven architecture, which is a great improvement. The changes involve removing the old Ember-style implementation and replacing it with a new FanControlCluster class, along with the necessary integration code and unit tests.
My review found a couple of high-severity issues that should be addressed:
- In
CodegenIntegration.cpp, several cluster configuration values are hardcoded, which limits the functionality and flexibility of the cluster. - The
FanControlClusterimplementation incorrectly reports theFeatureMapattribute as 0, which will prevent clients from discovering supported features.
Addressing these issues will make this migration complete and robust.
|
PR #43408: Size comparison from a6e7031 to 0794253 Full report (14 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, qpg, realtek, stm32)
|
|
PR #43408: Size comparison from a6e7031 to 8a8c60a Full report (26 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, efr32, nxp, qpg, realtek, stm32, telink)
|
|
PR #43408: Size comparison from a6e7031 to 9bd7eea Full report (3 builds for realtek, stm32)
|
4ade9dd to
1d2acd4
Compare
|
PR #43408: Size comparison from 832cfef to 1d2acd4 Full report (32 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, nxp, psoc6, qpg, realtek, stm32, telink)
|
|
PR #43408: Size comparison from 832cfef to fbe8afe Full report (11 builds for cc13x4_26x4, cc32xx, qpg, realtek, stm32)
|
|
PR #43408: Size comparison from 832cfef to c5c98c9 Full report (34 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
|
|
PR #43408: Size comparison from 832cfef to 871a07f Full report (34 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #43408 +/- ##
==========================================
+ Coverage 55.55% 55.66% +0.10%
==========================================
Files 1630 1632 +2
Lines 111147 111624 +477
Branches 13412 13402 -10
==========================================
+ Hits 61752 62135 +383
- Misses 49395 49489 +94 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
PR #43408: Size comparison from 832cfef to 4e8369f Full report (3 builds for realtek, stm32)
|
for more information, see https://pre-commit.ci
|
PR #43408: Size comparison from 6b87be8 to 749865d Full report (20 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, psoc6, qpg, realtek, stm32)
|
|
PR #43408: Size comparison from 6b87be8 to ff0518b Increases above 0.2%:
Full report (35 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
|
|
PR #43408: Size comparison from 6b87be8 to 6b50df9 Increases above 0.2%:
Full report (35 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
|
|
PR #43408: Size comparison from 6b87be8 to 59219f5 Increases above 0.2%:
Full report (35 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
|
…ute handling" This reverts commit 6b50df9.
|
PR #43408: Size comparison from 6e1fbc8 to cb2146d Increases above 0.2%:
Full report (35 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
|
for more information, see https://pre-commit.ci
|
PR #43408: Size comparison from 75dd85c to dfe7129 Increases above 0.2%:
Full report (35 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
|
|
PR #43408: Size comparison from 75dd85c to 73882f3 Full report (21 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, nrfconnect, psoc6, qpg, realtek, stm32)
|
|
PR #43408: Size comparison from 3e1a6f8 to d1ad8a0 Increases above 0.2%:
Full report (35 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
|
…d redundant checks for On/Off state and adjusted tests to reflect updated behavior, ensuring PercentCurrent and SpeedCurrent are set to zero when the fan is off.
Summary
Migrates the Fan Control cluster from the legacy Ember implementation to the code-driven architecture and adds a fan device to the
all-devices-app.Changes:
FanControlClusterclass withReadAttribute,WriteAttribute,InvokeCommandfor the Step command, and attribute cascades.CodegenIntegration.all-devices-app.all-devices-app.Related issues
#43161
Testing
Tested using
chip-all-clusters-app,chip-all-devices-app, andchip-repl.