]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pwm: max7360: Populate missing .sizeof_wfhw in max7360_pwm_ops
authorRichard Genoud <richard.genoud@bootlin.com>
Tue, 13 Jan 2026 16:39:07 +0000 (17:39 +0100)
committerUwe Kleine-König <ukleinek@kernel.org>
Mon, 19 Jan 2026 17:31:05 +0000 (18:31 +0100)
The sizeof_wfhw field wasn't populated in max7360_pwm_ops so it was set
to 0 by default.
While this is ok for now because:
sizeof(struct max7360_pwm_waveform) < PWM_WFHWSIZE
in the future, if struct max7360_pwm_waveform grows, it could lead to
stack corruption.

Fixes: d93a75d94b79 ("pwm: max7360: Add MAX7360 PWM support")
Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Link: https://patch.msgid.link/20260113163907.368919-1-richard.genoud@bootlin.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
drivers/pwm/pwm-max7360.c

index 16261958ce7ffb261b5a7cc7b1d47f63d6d398c2..732969303dd7f7357d11da908b591ed9189c5658 100644 (file)
@@ -153,6 +153,7 @@ static int max7360_pwm_read_waveform(struct pwm_chip *chip,
 }
 
 static const struct pwm_ops max7360_pwm_ops = {
+       .sizeof_wfhw = sizeof(struct max7360_pwm_waveform),
        .request = max7360_pwm_request,
        .round_waveform_tohw = max7360_pwm_round_waveform_tohw,
        .round_waveform_fromhw = max7360_pwm_round_waveform_fromhw,