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

sensor: tsl2591: fix: Address CID 353644 & 353654 #76669

Conversation

kurtjd
Copy link
Contributor

@kurtjd kurtjd commented Aug 4, 2024

Coverity is concerned about potential overflow from implicit sign extension in multiplication operation (since operands are implicitly promoted to int32_t, which two uint16_t's could theoretically overflow when multiplied together before the result is cast to int64_t). Although this shouldn't happen in practice due to the range of values operands can take on, perform explicit cast to int64_t on operands just to be on the safe side.

Fixes #74750
Fixes #74752

Fixes implicit sign-extension/potential overflow by explicitly casting
to int64_t.

Signed-off-by: Kurtis Dinelle <kurtisdinelle@gmail.com>
@aescolar aescolar added the backport v3.7-branch Request backport to the v3.7-branch label Oct 2, 2024
@aescolar aescolar merged commit 5eeff69 into zephyrproject-rtos:main Oct 2, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Sensors Sensors backport v3.7-branch Request backport to the v3.7-branch size: XS A PR changing only a single line of code
Projects
None yet
5 participants