summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorArnav Kapoor <kapoorarnav43@gmail.com>2026-10-24 00:56:51 +0530
committerJonathan Cameron <jonathan.cameron@oss.qualcomm.com>2026-11-02 00:39:24 +0000
commit7b5f54280f8e6ef07664f6705dd005feefbe87d1 (patch)
treec9c7d99125114b965b09dbf406996fd7f1e0470e /tools/perf/scripts/python
parentbd63c89aac5672f40cdc123a856493b628fc1abb (diff)
iio: proximity: sx9324: fix out-of-bounds read of scan period table
The scan period of the SX9324 is selected by the 5 bit wide SX9324_REG_GNRL_CTRL0_SCANPERIOD field, so it has 32 possible values. sx9324_scan_period_table[] however only has 16 entries, it was copied over from the SX9310 driver where the field is only 4 bits wide. sx9324_wait_for_sample() indexes the table with the raw field value, so all the codes from 16 to 31 read past the end of the array. The default value of the register is SX9324_REG_GNRL_CTRL0_SCANPERIOD_100MS (0x16, i.e. 22), so the out-of-bounds read happens with the default configuration of the device. It is only avoided when the device has an interrupt line, as the wait is only done in the polling case. The value read is then used as the duration of an msleep() call, so the sensor is polled with a completely random delay. Fill the table with the scan periods of all 32 codes, which are the periods documented for the corresponding sx9324_samp_freq_table[] entries, and add a static assertion to keep both tables in sync. Fixes: 4c18a890dff8 ("iio:proximity:sx9324: Add SX9324 support") Cc: stable@vger.kernel.org Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions