Skip to content

Commit a297d07

Browse files
author
Uwe Kleine-König
committed
pwm: Fix out-of-bounds access in of_pwm_single_xlate()
With args->args_count == 2 args->args[2] is not defined. Actually the flags are contained in args->args[1]. Fixes: 3ab7b6a ("pwm: Introduce single-PWM of_xlate function") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/243908750d306e018a3d4bf2eb745d53ab50f663.1704835845.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
1 parent 678164a commit a297d07

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/pwm/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ of_pwm_single_xlate(struct pwm_chip *chip, const struct of_phandle_args *args)
152152
pwm->args.period = args->args[0];
153153
pwm->args.polarity = PWM_POLARITY_NORMAL;
154154

155-
if (args->args_count == 2 && args->args[2] & PWM_POLARITY_INVERTED)
155+
if (args->args_count == 2 && args->args[1] & PWM_POLARITY_INVERTED)
156156
pwm->args.polarity = PWM_POLARITY_INVERSED;
157157

158158
return pwm;

0 commit comments

Comments
 (0)