]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
selftests/timers: fix write return value handlng
authorAndrzej Hajda <a.hajda@samsung.com>
Mon, 21 Sep 2015 13:33:41 +0000 (15:33 +0200)
committerJohn Stultz <john.stultz@linaro.org>
Fri, 11 Dec 2015 06:41:05 +0000 (22:41 -0800)
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
tools/testing/selftests/timers/clocksource-switch.c

index 627ec7425f78e1d235bd4561121ffe46bd12c362..fd88e3025bedc17d44c1537b8279aa6068d3ff47 100644 (file)
@@ -97,7 +97,7 @@ int get_cur_clocksource(char *buf, size_t size)
 int change_clocksource(char *clocksource)
 {
        int fd;
-       size_t size;
+       ssize_t size;
 
        fd = open("/sys/devices/system/clocksource/clocksource0/current_clocksource", O_WRONLY);