lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 18 Apr 2023 11:10:48 +0100
From:   Vincenzo Frascino <vincenzo.frascino@....com>
To:     Colin Ian King <colin.i.king@...il.com>,
        Shuah Khan <shuah@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kselftest@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kselftest: vDSO: Fix accumulation of uninitialized ret
 when CLOCK_REALTIME is undefined

Hi Colin,

On 4/17/23 11:47, Colin Ian King wrote:
> 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.
> 

I was wondering how did you find this.

Apart that:

Reviewed-by: Vincenzo Frascino <vincenzo.frascino@....com>

> Fixes: 03f55c7952c9 ("kselftest: Extend vDSO selftest to clock_getres")
> Signed-off-by: Colin Ian King <colin.i.king@...il.com>
> ---
>  tools/testing/selftests/vDSO/vdso_test_clock_getres.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/vDSO/vdso_test_clock_getres.c b/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
> index 15dcee16ff72..38d46a8bf7cb 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
> @@ -84,12 +84,12 @@ static inline int vdso_test_clock(unsigned int clock_id)
>  
>  int main(int argc, char **argv)
>  {
> -	int ret;
> +	int ret = 0;
>  
>  #if _POSIX_TIMERS > 0
>  
>  #ifdef CLOCK_REALTIME
> -	ret = vdso_test_clock(CLOCK_REALTIME);
> +	ret += vdso_test_clock(CLOCK_REALTIME);
>  #endif
>  
>  #ifdef CLOCK_BOOTTIME

-- 
Regards,
Vincenzo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ