Skip to content

Commit 8f7537e

Browse files
committed
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 (d93a75d: "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
2 parents 73c9007 + 0a155a8 commit 8f7537e

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

MAINTAINERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21103,6 +21103,10 @@ S: Maintained
2110321103
F: rust/helpers/pwm.c
2110421104
F: rust/kernel/pwm.rs
2110521105

21106+
PWM SUBSYSTEM DRIVERS [RUST]
21107+
R: Michal Wilczynski <m.wilczynski@samsung.com>
21108+
F: drivers/pwm/*.rs
21109+
2110621110
PXA GPIO DRIVER
2110721111
M: Robert Jarzmik <robert.jarzmik@free.fr>
2110821112
L: linux-gpio@vger.kernel.org

drivers/pwm/core.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,8 +2295,9 @@ static long pwm_cdev_ioctl(struct file *file, unsigned int cmd, unsigned long ar
22952295
.duty_offset_ns = wf.duty_offset_ns,
22962296
};
22972297

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;
23002301
}
23012302

23022303
case PWM_IOCTL_GETWF:
@@ -2329,8 +2330,9 @@ static long pwm_cdev_ioctl(struct file *file, unsigned int cmd, unsigned long ar
23292330
.duty_offset_ns = wf.duty_offset_ns,
23302331
};
23312332

2332-
return copy_to_user((struct pwmchip_waveform __user *)arg,
2333-
&cwf, sizeof(cwf));
2333+
ret = copy_to_user((struct pwmchip_waveform __user *)arg,
2334+
&cwf, sizeof(cwf));
2335+
return ret ? -EFAULT : 0;
23342336
}
23352337

23362338
case PWM_IOCTL_SETROUNDEDWF:

drivers/pwm/pwm-max7360.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ static int max7360_pwm_read_waveform(struct pwm_chip *chip,
153153
}
154154

155155
static const struct pwm_ops max7360_pwm_ops = {
156+
.sizeof_wfhw = sizeof(struct max7360_pwm_waveform),
156157
.request = max7360_pwm_request,
157158
.round_waveform_tohw = max7360_pwm_round_waveform_tohw,
158159
.round_waveform_fromhw = max7360_pwm_round_waveform_fromhw,

0 commit comments

Comments
 (0)