Skip to content

Commit 32789e5

Browse files
adityachopra29kartben
authored andcommitted
drivers: sensor: paj7620: Fix potential integer overflow in driver
Fix Coverity issue CID 524766: A potential integer overflow could occur in paj7620_set_sampling_rate() due to multiplication of sensor_value->val1 instance(which is of type int32_t) with 1000000 without typecasting it to int64_t. Fixes #90482 Signed-off-by: Aditya Chopra <[email protected]>
1 parent 89d1c52 commit 32789e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/sensor/pixart/paj7620/paj7620.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int paj7620_set_sampling_rate(const struct device *dev, const struct sens
107107
int ret;
108108
int fps;
109109
const struct paj7620_config *config = dev->config;
110-
int64_t uval = val->val1 * 1000000 + val->val2;
110+
int64_t uval = ((int64_t)val->val1 * (int64_t)1000000) + val->val2;
111111

112112
if (uval <= 120000000) {
113113
fps = PAJ7620_NORMAL_SPEED;

0 commit comments

Comments
 (0)