Re: [PATCH v3 05/18] rtla: Replace magic number with MAX_PATH
From: Tomas Glozar
Date: Tue Mar 03 2026 - 07:47:44 EST
čt 15. 1. 2026 v 18:26 odesílatel Wander Lairson Costa
<wander@xxxxxxxxxx> napsal:
> --- a/tools/tracing/rtla/src/osnoise.c
> +++ b/tools/tracing/rtla/src/osnoise.c
> @@ -52,7 +52,7 @@ char *osnoise_get_cpus(struct osnoise_context *context)
> int osnoise_set_cpus(struct osnoise_context *context, char *cpus)
> {
> char *orig_cpus = osnoise_get_cpus(context);
> - char buffer[1024];
> + char buffer[MAX_PATH];
Shouldn't this rather be strlen(cpus), a new constant, something like
CPU_STRING_MAX, or a value dynamically computed from nr_cpus? The
buffer is used to store "cpus" concatenated with "\n" to be written to
the osnoise/cpus file, it has nothing to do with MAX_PATH.
The contents of osnoise/cpus can be arbitrarily long [1], if you
specify more than 1040 CPUs - which is theoretically possible, as
CONFIG_NR_CPUs on e.g. Fedora 43 is 8192, although rather unlikely -
it will be truncated.
[1] 17f89102fe23 ("tracing/osnoise: Allow arbitrarily long CPU string")
Tomas