diff options
author | Patrick Palka <patrick@parcs.ath.cx> | 2013-10-11 13:11:55 -0400 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2013-10-18 19:45:58 -0400 |
commit | 891292a767c2453af0e5be9465e95b06b4b29ebe (patch) | |
tree | 86f9d3856dd7cb253f2b635274b78e81da7e8fe5 /kernel | |
parent | b7bc50e45111e59419474154736f419a555158d9 (diff) |
time: Fix signedness bug in sysfs_get_uname() and its callers
sysfs_get_uname() is erroneously declared as returning size_t even
though it may return a negative value, specifically -EINVAL. Its
callers then check whether its return value is less than zero and indeed
that is never the case for size_t.
This patch changes sysfs_get_uname() to return ssize_t and makes sure
its callers use ssize_t accordingly.
Signed-off-by: Patrick Palka <patrick@parcs.ath.cx>
[jstultz: Didn't apply cleanly, as a similar partial fix was also applied
so had to resolve the collisions]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/time/clockevents.c | 2 | ||||
-rw-r--r-- | kernel/time/clocksource.c | 2 | ||||
-rw-r--r-- | kernel/time/tick-internal.h | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 38959c866789..30554b9fb1f7 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
@@ -584,7 +584,7 @@ static ssize_t sysfs_unbind_tick_dev(struct device *dev, | |||
584 | const char *buf, size_t count) | 584 | const char *buf, size_t count) |
585 | { | 585 | { |
586 | char name[CS_NAME_LEN]; | 586 | char name[CS_NAME_LEN]; |
587 | size_t ret = sysfs_get_uname(buf, name, count); | 587 | ssize_t ret = sysfs_get_uname(buf, name, count); |
588 | struct clock_event_device *ce; | 588 | struct clock_event_device *ce; |
589 | 589 | ||
590 | if (ret < 0) | 590 | if (ret < 0) |
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index c9317e14aae6..ba3e502c955a 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
@@ -909,7 +909,7 @@ sysfs_show_current_clocksources(struct device *dev, | |||
909 | return count; | 909 | return count; |
910 | } | 910 | } |
911 | 911 | ||
912 | size_t sysfs_get_uname(const char *buf, char *dst, size_t cnt) | 912 | ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt) |
913 | { | 913 | { |
914 | size_t ret = cnt; | 914 | size_t ret = cnt; |
915 | 915 | ||
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index bc906cad709b..18e71f7fbc2a 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -31,7 +31,7 @@ extern void tick_install_replacement(struct clock_event_device *dev); | |||
31 | 31 | ||
32 | extern void clockevents_shutdown(struct clock_event_device *dev); | 32 | extern void clockevents_shutdown(struct clock_event_device *dev); |
33 | 33 | ||
34 | extern size_t sysfs_get_uname(const char *buf, char *dst, size_t cnt); | 34 | extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt); |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * NO_HZ / high resolution timer shared code | 37 | * NO_HZ / high resolution timer shared code |