diff mbox series

Use TASK_THREAD_TIMES_INFO_COUNT when calling task_info with TASK_THREAD_TIMES_INFO

Message ID ZGRDDNcOM2hA3CuT@jupiter.tail36e24.ts.net
State New
Headers show
Series Use TASK_THREAD_TIMES_INFO_COUNT when calling task_info with TASK_THREAD_TIMES_INFO | expand

Commit Message

Flavio Cruz May 17, 2023, 2:59 a.m. UTC
This hasn't caused any problems yet but we are passing a pointer to struct
task_thread_times_info which can cause problems if we populate over the
existing size of the struct.
---
 sysdeps/mach/clock_gettime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Samuel Thibault May 17, 2023, 5:23 p.m. UTC | #1
Applied, thanks!

Flavio Cruz, le mar. 16 mai 2023 22:59:24 -0400, a ecrit:
> This hasn't caused any problems yet but we are passing a pointer to struct
> task_thread_times_info which can cause problems if we populate over the
> existing size of the struct.
> ---
>  sysdeps/mach/clock_gettime.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c
> index cc8c821a7f..be775ed2bb 100644
> --- a/sysdeps/mach/clock_gettime.c
> +++ b/sysdeps/mach/clock_gettime.c
> @@ -62,7 +62,7 @@ __clock_gettime (clockid_t clock_id, struct timespec *ts)
>  	time_value_add (&t, &bi.system_time);
>  
>  	/* Live threads CPU time.  */
> -	count = TASK_EVENTS_INFO_COUNT;
> +	count = TASK_THREAD_TIMES_INFO_COUNT;
>  	err = __task_info (__mach_task_self (), TASK_THREAD_TIMES_INFO,
>  			   (task_info_t) &tti, &count);
>  	if (err)
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c
index cc8c821a7f..be775ed2bb 100644
--- a/sysdeps/mach/clock_gettime.c
+++ b/sysdeps/mach/clock_gettime.c
@@ -62,7 +62,7 @@  __clock_gettime (clockid_t clock_id, struct timespec *ts)
 	time_value_add (&t, &bi.system_time);
 
 	/* Live threads CPU time.  */
-	count = TASK_EVENTS_INFO_COUNT;
+	count = TASK_THREAD_TIMES_INFO_COUNT;
 	err = __task_info (__mach_task_self (), TASK_THREAD_TIMES_INFO,
 			   (task_info_t) &tti, &count);
 	if (err)