Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1536007
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation |
| Date | 2016-12-05 12:20 +0100 |
| Message-ID | <sKZtn-3Pb-7@gated-at.bofh.it> (permalink) |
| References | <sJ1IZ-7Hw-5@gated-at.bofh.it> <sJ1IZ-7Hw-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Tue 2016-11-29 17:11:50, Andy Lutomirski wrote:
> Negative values are special. Don't let users write them directly.
>
> Signed-off-by: Andy Lutomirski <luto@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
> --- a/drivers/base/power/sysfs.c
> +++ b/drivers/base/power/sysfs.c
> @@ -263,7 +263,11 @@ static ssize_t pm_qos_latency_tolerance_store(struct device *dev,
> s32 value;
> int ret;
>
> - if (kstrtos32(buf, 0, &value)) {
> + if (kstrtos32(buf, 0, &value) == 0) {
> + /* Users can't write negative values directly */
> + if (value < 0)
> + return -EINVAL;
> + } else {
> if (!strcmp(buf, "auto") || !strcmp(buf, "auto\n"))
> value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
> else if (!strcmp(buf, "any") || !strcmp(buf, "any\n"))
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation Andy Lutomirski <luto@kernel.org> - 2016-11-30 02:20 +0100 Re: [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation Pavel Machek <pavel@ucw.cz> - 2016-12-05 12:20 +0100
csiph-web