summaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/parallel-perf.py
diff options
context:
space:
mode:
authorCosmin Tanislav <demonsingur@gmail.com>2025-06-13 14:21:53 +0300
committerHans Verkuil <hverkuil@xs4all.nl>2025-06-23 12:11:04 +0200
commitc0b1da281d84d33281fc49289f0c7f8aada450ff (patch)
tree32f753825180b5964eac960c798fd7162bd50d3f /tools/perf/scripts/python/parallel-perf.py
parent032a68ccb7834b28d51c11bbfe1c2db02e65ad28 (diff)
downloadlinux-c0b1da281d84d33281fc49289f0c7f8aada450ff.tar.gz
linux-c0b1da281d84d33281fc49289f0c7f8aada450ff.zip
media: rc: ir-spi: avoid overflow in multiplication
Switch to u64 arithmetic and use DIV_ROUND_CLOSEST_ULL() to avoid the overflow. buffer[i] is unsigned int and is limited by the lirc core to IR_MAX_DURATION, which is 500000. idata->freq is u32, which has a max value of 0xFFFFFFFF. In the case where buffer[i] is 500000, idata->freq overflows the u32 multiplication for any values >= 8590. 0xFFFFFFFF / 500000 ~= 8589 By casting buffer[i] to u64, idata->freq can be any u32 value without overflowing the multiplication. 0xFFFFFFFFFFFFFFFF / 500000 ~= 36893488147419 (> 4294967295) The result of the final operation will fit back into the unsigned int limits without any issues. 500000 * 0xFFFFFFFF / 1000000 = 0x80000000 (< 0xFFFFFFFF) Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'tools/perf/scripts/python/parallel-perf.py')
0 files changed, 0 insertions, 0 deletions