2014-07-18 15:31:08

by Andrey Utkin

[permalink] [raw]
Subject: [PATCH 1/5] tools/power/cpupower/utils/helpers/sysfs.c: drop negativity check on unsigned value

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80621
Reported-by: David Binderman <[email protected]>
Signed-off-by: Andrey Utkin <[email protected]>
---
tools/power/cpupower/utils/helpers/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/power/cpupower/utils/helpers/sysfs.c b/tools/power/cpupower/utils/helpers/sysfs.c
index 851c7a1..09afe5d 100644
--- a/tools/power/cpupower/utils/helpers/sysfs.c
+++ b/tools/power/cpupower/utils/helpers/sysfs.c
@@ -81,7 +81,7 @@ int sysfs_is_cpu_online(unsigned int cpu)
close(fd);

value = strtoull(linebuf, &endp, 0);
- if (value > 1 || value < 0)
+ if (value > 1)
return -EINVAL;

return value;
--
1.8.5.5


2014-07-19 19:14:29

by Andrey Utkin

[permalink] [raw]
Subject: [PATCH 1/5] tools/power/cpupower/utils/helpers/sysfs.c: drop negativity check on unsigned value

Resubmitting to send also to [email protected] as requested by
Rafael J. Wysocki <[email protected]>

---8<---

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80621
Reported-by: David Binderman <[email protected]>
Signed-off-by: Andrey Utkin <[email protected]>
---
tools/power/cpupower/utils/helpers/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/power/cpupower/utils/helpers/sysfs.c b/tools/power/cpupower/utils/helpers/sysfs.c
index 851c7a1..09afe5d 100644
--- a/tools/power/cpupower/utils/helpers/sysfs.c
+++ b/tools/power/cpupower/utils/helpers/sysfs.c
@@ -81,7 +81,7 @@ int sysfs_is_cpu_online(unsigned int cpu)
close(fd);

value = strtoull(linebuf, &endp, 0);
- if (value > 1 || value < 0)
+ if (value > 1)
return -EINVAL;

return value;
--
1.8.5.5

2014-07-19 20:10:24

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH 1/5] tools/power/cpupower/utils/helpers/sysfs.c: drop negativity check on unsigned value

On Saturday, July 19, 2014 10:14:04 PM Andrey Utkin wrote:
> Resubmitting to send also to [email protected] as requested by
> Rafael J. Wysocki <[email protected]>
>
> ---8<---
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80621
> Reported-by: David Binderman <[email protected]>
> Signed-off-by: Andrey Utkin <[email protected]>

Queued up for 3.17, thanks!

> ---
> tools/power/cpupower/utils/helpers/sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/power/cpupower/utils/helpers/sysfs.c b/tools/power/cpupower/utils/helpers/sysfs.c
> index 851c7a1..09afe5d 100644
> --- a/tools/power/cpupower/utils/helpers/sysfs.c
> +++ b/tools/power/cpupower/utils/helpers/sysfs.c
> @@ -81,7 +81,7 @@ int sysfs_is_cpu_online(unsigned int cpu)
> close(fd);
>
> value = strtoull(linebuf, &endp, 0);
> - if (value > 1 || value < 0)
> + if (value > 1)
> return -EINVAL;
>
> return value;
>

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.