Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ColorControl]Prevent any chance of division by 0 #25662

Merged
merged 2 commits into from
Mar 13, 2023

Conversation

jmartinez-silabs
Copy link
Member

The different color transition values calculations use a division by the Total amount of steps of the transition. From a quick code overview, stepsTotal was always set to a value >= to 1.

Still to be on the kosher side; add checks to prevent any division by 0 and to skip the operation for a division by 1.

this PR also update some C casts to C++

@github-actions
Copy link

PR #25662: Size comparison from d1604b3 to 2e54b29

Full report (1 build for cc32xx)
platform target config section d1604b3 2e54b29 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 645097 645097 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 930293 930293 0 0.0
.debug_aranges 87384 87384 0 0.0
.debug_frame 300248 300248 0 0.0
.debug_info 20245939 20245939 0 0.0
.debug_line 2660971 2660971 0 0.0
.debug_loc 2804896 2804896 0 0.0
.debug_ranges 283168 283168 0 0.0
.debug_str 3026947 3026947 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105993 105993 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 379204 379204 0 0.0
.symtab 256912 256912 0 0.0
.text 536984 536984 0 0.0

@github-actions
Copy link

PR #25662: Size comparison from d1604b3 to ec3f4a2

Full report (2 builds for cc32xx, mbed)
platform target config section d1604b3 ec3f4a2 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 645097 645097 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 930293 930293 0 0.0
.debug_aranges 87384 87384 0 0.0
.debug_frame 300248 300248 0 0.0
.debug_info 20245939 20245939 0 0.0
.debug_line 2660971 2660971 0 0.0
.debug_loc 2804896 2804896 0 0.0
.debug_ranges 283168 283168 0 0.0
.debug_str 3026947 3026947 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105993 105993 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 379204 379204 0 0.0
.symtab 256912 256912 0 0.0
.text 536984 536984 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2468104 2468104 0 0.0
.bss 215964 215964 0 0.0
.data 5880 5880 0 0.0
.text 1430748 1430748 0 0.0

@jmartinez-silabs jmartinez-silabs enabled auto-merge (squash) March 13, 2023 21:53
@jmartinez-silabs jmartinez-silabs merged commit b02a6ca into project-chip:master Mar 13, 2023
@jmartinez-silabs jmartinez-silabs deleted the check_div0 branch March 13, 2023 23:11
lecndav pushed a commit to lecndav/connectedhomeip that referenced this pull request Mar 22, 2023
* Prevent any chance of division by 0 in Colorcontol. Update some C casts to C++

* Address comments
mwswartwout pushed a commit to mwswartwout/connectedhomeip that referenced this pull request Mar 27, 2023
* Prevent any chance of division by 0 in Colorcontol. Update some C casts to C++

* Address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants