iio: invensense: Prevent possible integer overflow while multiplication

Typecast a variable to int64_t for 64-bit arithmetic multiplication.

Signed-off-by: Karan Sanghavi <karansanghvi98@gmail.com>
Link: https://scan7.scan.coverity.com/#/project-view/51946/11354?selectedIssue=1586045
Link: https://patch.msgid.link/20241103-coverity1586045integeroverflow-v1-1-43ea37a3f3cd@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Karan Sanghavi 2024-11-03 08:43:14 +00:00 committed by Jonathan Cameron
parent a79f049b2e
commit 6dfc256151

View File

@ -109,8 +109,8 @@ static bool inv_update_chip_period(struct inv_sensors_timestamp *ts,
static void inv_align_timestamp_it(struct inv_sensors_timestamp *ts)
{
const int64_t period_min = ts->min_period * ts->mult;
const int64_t period_max = ts->max_period * ts->mult;
const int64_t period_min = (int64_t)ts->min_period * ts->mult;
const int64_t period_max = (int64_t)ts->max_period * ts->mult;
int64_t add_max, sub_max;
int64_t delta, jitter;
int64_t adjust;