[PATCH stalld 51/52] stalld: fix error return in queue_track_get_cpu
Wander Lairson Costa <[email protected]> Mon, 8 Jun 2026 15:32:01 -0300
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
queue_track_get_cpu() returns 1 when the buffer is too small to hold a stalld_cpu_data structure. Because callers treat any positive return as a successful read, the parsing stage proceeds on a buffer that was never filled, reading uninitialized memory. Return 0 instead so the caller recognizes the failure and retries with the enlarged buffer on the next monitoring cycle. Signed-off-by: Wander Lairson Costa <[email protected]> --- src/queue_track.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/queue_track.c b/src/queue_track.c index 2c1a11b..a1a127a 100644 --- a/src/queue_track.c +++ b/src/queue_track.c @@ -137,7 +137,7 @@ static int queue_track_get_cpu(char *buffer, int size, int cpu) config_buffer_size = sizeof(struct stalld_cpu_data); log_msg("queue_track is larger than the buffer, increasing the buffer to %zu\n", config_buffer_size); - return 1; + return 0; } retval = get_cpu_data((struct stalld_cpu_data *) buffer, cpu); -- 2.54.0