kselftest: vDSO: Fix accumulation of uninitialized ret when CLOCK_REALTIME is undefined
authorColin Ian King <colin.i.king@gmail.com>
Mon, 17 Apr 2023 10:47:43 +0000 (11:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:21:02 +0000 (16:21 +0200)
commit64d09c0e832d261f028884c91c1c505e237052ae
tree026df4ecf99321b023ed9730eb1f8990557168ce
parentb8a6ba524d41f4da102e65f90498d9a910839621
kselftest: vDSO: Fix accumulation of uninitialized ret when CLOCK_REALTIME is undefined

[ Upstream commit 375b9ff53cb6f9c042817b75f2be0a650626dc4f ]

In the unlikely case that CLOCK_REALTIME is not defined, variable ret is
not initialized and further accumulation of return values to ret can leave
ret in an undefined state. Fix this by initialized ret to zero and changing
the assignment of ret to an accumulation for the CLOCK_REALTIME case.

Fixes: 03f55c7952c9 ("kselftest: Extend vDSO selftest to clock_getres")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/vDSO/vdso_test_clock_getres.c