summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2024-09-16 17:09:10 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2024-09-30 09:20:54 +0100
commit506a1ac4c4464a61e4336e135841067dbc040aaa (patch)
tree0df488748c93085ee9750a6439fed0bc04c4d69d /drivers/iio
parentcd8247cd41bc983398f5eb572f660752adfe7a1a (diff)
downloadlinux-stable-506a1ac4c4464a61e4336e135841067dbc040aaa.tar.gz
linux-stable-506a1ac4c4464a61e4336e135841067dbc040aaa.tar.bz2
linux-stable-506a1ac4c4464a61e4336e135841067dbc040aaa.zip
iio: bmi323: fix copy and paste bugs in suspend resume
This code is using bmi323_reg_savestate[] and ->reg_settings[] instead of bmi323_ext_reg_savestate[] and ->ext_reg_settings[]. This was discovered by Smatch: drivers/iio/imu/bmi323/bmi323_core.c:2202 bmi323_core_runtime_suspend() error: buffer overflow 'bmi323_reg_savestate' 9 <= 11 Fixes: 16531118ba63 ("iio: bmi323: peripheral in lowest power state on suspend") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://patch.msgid.link/7175b8ec-85cf-4fbf-a4e1-c4c43c3b665c@stanley.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/imu/bmi323/bmi323_core.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/iio/imu/bmi323/bmi323_core.c b/drivers/iio/imu/bmi323/bmi323_core.c
index 1d1405d37c5a..c953501c2a75 100644
--- a/drivers/iio/imu/bmi323/bmi323_core.c
+++ b/drivers/iio/imu/bmi323/bmi323_core.c
@@ -2198,12 +2198,12 @@ static int bmi323_core_runtime_suspend(struct device *dev)
}
for (unsigned int i = 0; i < ARRAY_SIZE(bmi323_ext_reg_savestate); i++) {
- ret = bmi323_read_ext_reg(data, bmi323_reg_savestate[i],
- &savestate->reg_settings[i]);
+ ret = bmi323_read_ext_reg(data, bmi323_ext_reg_savestate[i],
+ &savestate->ext_reg_settings[i]);
if (ret) {
dev_err(data->dev,
"Error reading bmi323 external reg 0x%x: %d\n",
- bmi323_reg_savestate[i], ret);
+ bmi323_ext_reg_savestate[i], ret);
return ret;
}
}
@@ -2242,12 +2242,12 @@ static int bmi323_core_runtime_resume(struct device *dev)
}
for (unsigned int i = 0; i < ARRAY_SIZE(bmi323_ext_reg_savestate); i++) {
- ret = bmi323_write_ext_reg(data, bmi323_reg_savestate[i],
- savestate->reg_settings[i]);
+ ret = bmi323_write_ext_reg(data, bmi323_ext_reg_savestate[i],
+ savestate->ext_reg_settings[i]);
if (ret) {
dev_err(data->dev,
"Error writing bmi323 external reg 0x%x: %d\n",
- bmi323_reg_savestate[i], ret);
+ bmi323_ext_reg_savestate[i], ret);
return ret;
}
}