Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pwm/for-6.19-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux

Pull pwm fixes and a maintainer update from Uwe Kleine-König:

- pwm: Ensure ioctl() returns a negative errno on error

This affects two ioctls on /dev/pwmchipX where the return value of
copy_to_user() was passed to userspace. This is fixed to return
-EFAULT now instead.

- pwm: max7360: Populate missing .sizeof_wfhw in max7360_pwm_ops

This fixes an oversight in the original commit that added support for
the max7360 driver (d93a75d94b79: "pwm: max7360: Add MAX7360 PWM
support"). There is no user-visible effect because the .sizeof_wfhw
member is just a safe guard that the memory provided by the core is
big enough. While it currently is big enough and there is no reason
to assume that will change, doing that correctly is necessary.

- MAINTAINERS: Add Michal Wilczynski as reviewer for PWM rust drivers

Michal cares for the Rust parts of the pwm subsystem. Several of the
patches sent recently for the (for now) only Rust pwm driver did not
add Michal to Cc which resulted in the patches waiting for review as
I thought Michal would care but he wasn't aware of them.

* tag 'pwm/for-6.19-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux:
MAINTAINERS: Add myself as reviewer for PWM rust drivers
pwm: max7360: Populate missing .sizeof_wfhw in max7360_pwm_ops
pwm: Ensure ioctl() returns a negative errno on error

+11 -4
+4
MAINTAINERS
··· 21103 21103 F: rust/helpers/pwm.c 21104 21104 F: rust/kernel/pwm.rs 21105 21105 21106 + PWM SUBSYSTEM DRIVERS [RUST] 21107 + R: Michal Wilczynski <m.wilczynski@samsung.com> 21108 + F: drivers/pwm/*.rs 21109 + 21106 21110 PXA GPIO DRIVER 21107 21111 M: Robert Jarzmik <robert.jarzmik@free.fr> 21108 21112 L: linux-gpio@vger.kernel.org
+6 -4
drivers/pwm/core.c
··· 2295 2295 .duty_offset_ns = wf.duty_offset_ns, 2296 2296 }; 2297 2297 2298 - return copy_to_user((struct pwmchip_waveform __user *)arg, 2299 - &cwf, sizeof(cwf)); 2298 + ret = copy_to_user((struct pwmchip_waveform __user *)arg, 2299 + &cwf, sizeof(cwf)); 2300 + return ret ? -EFAULT : 0; 2300 2301 } 2301 2302 2302 2303 case PWM_IOCTL_GETWF: ··· 2330 2329 .duty_offset_ns = wf.duty_offset_ns, 2331 2330 }; 2332 2331 2333 - return copy_to_user((struct pwmchip_waveform __user *)arg, 2334 - &cwf, sizeof(cwf)); 2332 + ret = copy_to_user((struct pwmchip_waveform __user *)arg, 2333 + &cwf, sizeof(cwf)); 2334 + return ret ? -EFAULT : 0; 2335 2335 } 2336 2336 2337 2337 case PWM_IOCTL_SETROUNDEDWF:
+1
drivers/pwm/pwm-max7360.c
··· 153 153 } 154 154 155 155 static const struct pwm_ops max7360_pwm_ops = { 156 + .sizeof_wfhw = sizeof(struct max7360_pwm_waveform), 156 157 .request = max7360_pwm_request, 157 158 .round_waveform_tohw = max7360_pwm_round_waveform_tohw, 158 159 .round_waveform_fromhw = max7360_pwm_round_waveform_fromhw,