| 68150b90 | 09-Aug-2023 |
Bruce Richardson <bruce.richardson@intel.com> |
telemetry: use standard logging
Now that logging is moved out of EAL, we don't need injection of the logtype and logging function from EAL to telemetry library, simplifying things.
Signed-off-by: B
telemetry: use standard logging
Now that logging is moved out of EAL, we don't need injection of the logtype and logging function from EAL to telemetry library, simplifying things.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|
| c9df59bc | 25-May-2023 |
David Marchand <david.marchand@redhat.com> |
telemetry: fix JSON string formatter
For large strings, we were incorrectly copying uninitialised data to the output buffer. Restore previous code.
Fixes: a515b7204e28 ("telemetry: remove VLA in JS
telemetry: fix JSON string formatter
For large strings, we were incorrectly copying uninitialised data to the output buffer. Restore previous code.
Fixes: a515b7204e28 ("telemetry: remove VLA in JSON string formatter")
Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
show more ...
|
| 9f5c7170 | 05-Apr-2023 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
telemetry: remove non-portable array initialization
Use of ranges in designated initialization are a non-standard gcc extension.
Only initialize '_' and '/' elements of the array and filter tests o
telemetry: remove non-portable array initialization
Use of ranges in designated initialization are a non-standard gcc extension.
Only initialize '_' and '/' elements of the array and filter tests of characters through name with standard C isalnum before checking the array.
Suggested-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru> Suggested-by: Bruce Richardson <bruce.richardson@intel.com> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
show more ...
|
| a515b720 | 05-Apr-2023 |
Bruce Richardson <bruce.richardson@intel.com> |
telemetry: remove VLA in JSON string formatter
Since variable length arrays (VLAs) are potentially insecure and unsupported by some compilers, rework the code to remove their use. As with previous c
telemetry: remove VLA in JSON string formatter
Since variable length arrays (VLAs) are potentially insecure and unsupported by some compilers, rework the code to remove their use. As with previous changes to remove VLAs in the telemetry code, this function uses two methods to avoid modifying the buffer when adding to it fails: * if there are only a few characters in the buffer, save them off to restore on failure, then use the buffer as-is, * otherwise use malloc rather than a VLA to allocate a temporary buffer and copy from that on success only.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|
| 0737585e | 05-Apr-2023 |
Bruce Richardson <bruce.richardson@intel.com> |
telemetry: rename local variables in JSON string formatter
In the newly separated out function, rename "tmp" to "buf" to have more meaningful variable names.
Signed-off-by: Bruce Richardson <bruce.
telemetry: rename local variables in JSON string formatter
In the newly separated out function, rename "tmp" to "buf" to have more meaningful variable names.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|
| d23f5eab | 05-Apr-2023 |
Bruce Richardson <bruce.richardson@intel.com> |
telemetry: split out body of JSON string formatter
To enable further rework to (efficiently) avoid using variable-length arrays, we first separate out the body of the __json_format_str function. Thi
telemetry: split out body of JSON string formatter
To enable further rework to (efficiently) avoid using variable-length arrays, we first separate out the body of the __json_format_str function. This means that the actual VLA buffer is in the wrapper function, and means we can reuse the actual writing code in multiple code paths without duplication.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|
| 2e6a781d | 05-Apr-2023 |
Bruce Richardson <bruce.richardson@intel.com> |
telemetry: remove variable length array for printf
The json_snprintf function, used to add json characters on to a buffer, leaving the buffer unmodified in case of error, used a variable length arra
telemetry: remove variable length array for printf
The json_snprintf function, used to add json characters on to a buffer, leaving the buffer unmodified in case of error, used a variable length array to store the data temporarily while checking for overflow. VLAs can be unsafe, and are unsupported by some compilers, so remove use of the VLA.
For the normal case where there is only a small amount of existing text in the buffer (<4 chars) to be preserved, save that off temporarily to a local array, and restore on error. To handle cases where there is more than a few characters in the buffer, we use the existing logic of doing the print to a temporary buffer initially and then copying. In this case, though we use malloc-allocated buffer rather than VLA.
Within the unit tests, the "telemetry_data_autotests" test cases - which mimic real telemetry use - all exercise the first path. The telemetry_json_autotest cases work directly with generating json, and use uninitialized buffers so also test the second, malloc-allocated buffer, cases.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
show more ...
|