pwm: cadence-ttc: Insufficient elements in array
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Mon, 1 Sep 2025 17:00:12 +0000 (18:00 +0100)
committerMichal Simek <michal.simek@amd.com>
Thu, 9 Oct 2025 07:07:03 +0000 (09:07 +0200)
commitfe8d071c49845c6ad1a387762f048ef158326580
tree333dd5cd1ee1eb8ae274388ef839166a2a804295
parent4146a31dcec709058a8e793b86712b0ffa1ba15a
pwm: cadence-ttc: Insufficient elements in array

The Cadence TTC has 3 channels that can each be used for PWM functions.
Ensure that the array has sufficient elements to avoid a possible memory
access overrun. Use a macro to keep the array size and limit checks in
sync so adjust checks to work with this.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Link: https://lore.kernel.org/r/20250901-cadence_pwm-v1-1-140b04cd73a9@linaro.org
Signed-off-by: Michal Simek <michal.simek@amd.com>
drivers/pwm/pwm-cadence-ttc.c