From 1e4629518b175c6317ec5b6ecef52943cff21f4e Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Fri, 22 Dec 2023 17:11:30 -0800 Subject: [PATCH] audio_stream: Fix uninitialized data in alignment_constants Audio stream objects are generally allocated out of zero'd heap memory, but the computed alignment fields need non-zero values to have correct behavior. These were being left as garbage. Set them to a byte and frame alignment of 1, as this corresponds to pervasive convention in the tree. But note that a byte alignment of 1 is actually technically incorrect, as all existing DSP targets are on architectures which don't allow misaligned loads. But existing component code is universally coded correctly anyway. (It's worth pointing out that "set_alignment_constants()" is now exposed as an API call on abstracted source/sink objects. But the only current implementation is on audio_stream. Future implementations will need to correctly initialize themselves.) This is a partial fix for Issue #8639 Signed-off-by: Andy Ross --- src/audio/audio_stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/audio/audio_stream.c b/src/audio/audio_stream.c index 2a1a7a05e64a..468a37290764 100644 --- a/src/audio/audio_stream.c +++ b/src/audio/audio_stream.c @@ -141,6 +141,7 @@ void audio_stream_init(struct audio_stream *audio_stream, void *buff_addr, uint3 audio_stream->addr = buff_addr; audio_stream->end_addr = (char *)audio_stream->addr + size; + audio_stream_init_alignment_constants(1, 1, audio_stream); source_init(audio_stream_get_source(audio_stream), &audio_stream_source_ops, &audio_stream->runtime_stream_params); sink_init(audio_stream_get_sink(audio_stream), &audio_stream_sink_ops,