I have the following Smatch report.

drivers/pwm/pwm-cadence-ttc.c:73 cadence_ttc_pwm_set_invert() error: buffer overflow 'priv->invert' 2 <= 2 drivers/pwm/pwm-cadence-ttc.c:138 cadence_ttc_pwm_set_config() error: buffer overflow 'priv->invert' 2 <= 2

Indeed yes, the code allows a maximum index of 2 into an array with 2 elements, so that is out of bounds. My question is which is wrong? Should the array have 3 elements or should the index be limited to 1, or is the value being checked 1 based?

Thanks,
Andrew

Reply via email to