-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Bug
Copy link
Labels
CoverityA Coverity detected issue or its fixA Coverity detected issue or its fixarea: SensorsSensorsSensorsbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bugMedium impact/importance bug
Description
Static code scan issues found in file:
Category: Integer handling issues
Function: tsl2591_channel_get
Component: Drivers
CID: 353654
Details:
zephyr/drivers/sensor/ams/tsl2591/tsl2591.c
Line 139 in dcf4291
int64_t cpl = data->atime * data->again; |
133 }
134
135 static int tsl2591_channel_get(const struct device *dev, enum sensor_channel chan,
136 struct sensor_value *val)
137 {
138 const struct tsl2591_data *data = dev->data;
>>> CID 353654: Integer handling issues (SIGN_EXTENSION)
>>> Suspicious implicit sign extension: "data->again" with type "uint16_t" (16 bits, unsigned) is promoted in "data->atime * data->again" to type "int" (32 bits, signed), then sign-extended to type "long long" (64 bits, signed). If "data->atime * data->again" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
139 int64_t cpl = data->atime * data->again;
140 int64_t strength;
141
142 /* Unfortunately, datasheet does not provide a lux conversion formula for this particular
143 * device. There is still ongoing discussion about the proper formula, though this
144 * implementation uses a slightly modified version of the Adafruit library formula:
For more information about the violation, check the Coverity Reference. (CWE-194)
Please fix or provide comments in coverity using the link:
https://scan9.scan.coverity.com/#/project-view/29271/12996?selectedIssue=353654
Note: This issue was created automatically. Priority was set based on classification
of the file affected and the impact field in coverity. Assignees were set using the MAINTAINERS file.
Metadata
Metadata
Assignees
Labels
CoverityA Coverity detected issue or its fixA Coverity detected issue or its fixarea: SensorsSensorsSensorsbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bugMedium impact/importance bug