[PATCH 06/14] vdso/gettimeofday: Return bool from clock_gettime() helpers

David Laight david.laight.linux at gmail.com
Sat Jul 19 04:16:59 PDT 2025


On Wed, 16 Jul 2025 15:35:09 +0100
Mark Brown <broonie at kernel.org> wrote:

> On Wed, Jul 16, 2025 at 03:23:24PM +0200, Thomas Weißschuh wrote:
> 
> > Can you try the following?
> > I missed this despite the double-checking after the last reported issue.  
> 
> I needed to fix that up a bit, it was missing an update of the final ret
> in the function and didn't apply directly to -next for some reason so I
> had to manually apply but it seems to do the trick, thanks!
> 
> Tested-by: Mark Brown <broonie at kernel.org>
> 
> with this against -next:
> 
> diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
> index 97aa9059a5c97..487e3458e536e 100644
> --- a/lib/vdso/gettimeofday.c
> +++ b/lib/vdso/gettimeofday.c
> @@ -365,18 +365,18 @@ __cvdso_clock_gettime32_data(const struct vdso_time_data *vd, clockid_t clock,
>  			     struct old_timespec32 *res)
>  {
>  	struct __kernel_timespec ts;
> -	int ret;
> +	bool ok;
>  
> -	ret = __cvdso_clock_gettime_common(vd, clock, &ts);
> +	ok = __cvdso_clock_gettime_common(vd, clock, &ts);
>  
> -	if (unlikely(ret))
> +	if (unlikely(!ok))

Do you even need 'ok' at all, just:
	if (unlikely(!__cvdso_clock_gettime_common(vd, clock, &ts)))

>  		return clock_gettime32_fallback(clock, res);
>  
> -	/* For ret == 0 */
> +	/* For ok == true */
>  	res->tv_sec = ts.tv_sec;
>  	res->tv_nsec = ts.tv_nsec;
>  
> -	return ret;
> +	return 0;
>  }
>  
>  static __maybe_unused int

	David





More information about the linux-arm-kernel mailing list