summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-01-20 09:46:29 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-01-20 09:46:29 -0800
commit8f7537efbe5636a798cf885ea2fa0e4889995fa9 (patch)
tree5449ad5b4288210912bfa4addded99ac6257ebbd /drivers
parent73c9007d9b94065cbb60f318ff0d3637d1c8283e (diff)
parent0a155a8a24ddc647aaf28ce7cdb14af7270c158f (diff)
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
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pwm/core.c10
-rw-r--r--drivers/pwm/pwm-max7360.c1
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index cd06229db394..ec8731515333 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -2295,8 +2295,9 @@ static long pwm_cdev_ioctl(struct file *file, unsigned int cmd, unsigned long ar
.duty_offset_ns = wf.duty_offset_ns,
};
- return copy_to_user((struct pwmchip_waveform __user *)arg,
- &cwf, sizeof(cwf));
+ ret = copy_to_user((struct pwmchip_waveform __user *)arg,
+ &cwf, sizeof(cwf));
+ return ret ? -EFAULT : 0;
}
case PWM_IOCTL_GETWF:
@@ -2329,8 +2330,9 @@ static long pwm_cdev_ioctl(struct file *file, unsigned int cmd, unsigned long ar
.duty_offset_ns = wf.duty_offset_ns,
};
- return copy_to_user((struct pwmchip_waveform __user *)arg,
- &cwf, sizeof(cwf));
+ ret = copy_to_user((struct pwmchip_waveform __user *)arg,
+ &cwf, sizeof(cwf));
+ return ret ? -EFAULT : 0;
}
case PWM_IOCTL_SETROUNDEDWF:
diff --git a/drivers/pwm/pwm-max7360.c b/drivers/pwm/pwm-max7360.c
index 16261958ce7f..732969303dd7 100644
--- a/drivers/pwm/pwm-max7360.c
+++ b/drivers/pwm/pwm-max7360.c
@@ -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,