mirror of https://github.com/thesofproject/sof.git
Audio: Component: Fix the potential risks of HiFi3 audio_stream_copy
Use while (shorts > 0) instead of while (short) to reduce the forever loop risk. Use general instruction AE_MIN32 replace AE_MIN_32_signed which is an internal proto intended for Xtensa compiler. Signed-off-by: Andrula Song <andrula.song@intel.com>
This commit is contained in:
parent
50c8aeb710
commit
40c8e477f0
|
@ -252,13 +252,13 @@ int audio_stream_copy(const struct audio_stream *source, uint32_t ioffset,
|
||||||
ae_valign outu = AE_ZALIGN64();
|
ae_valign outu = AE_ZALIGN64();
|
||||||
|
|
||||||
/* copy with 16bit as the minimum unit since the minimum sample size is 16 bit*/
|
/* copy with 16bit as the minimum unit since the minimum sample size is 16 bit*/
|
||||||
while (shorts) {
|
while (shorts > 0) {
|
||||||
src = audio_stream_wrap(source, src);
|
src = audio_stream_wrap(source, src);
|
||||||
dst = audio_stream_wrap(sink, dst);
|
dst = audio_stream_wrap(sink, dst);
|
||||||
shorts_src = audio_stream_samples_without_wrap_s16(source, src);
|
shorts_src = audio_stream_samples_without_wrap_s16(source, src);
|
||||||
shorts_dst = audio_stream_samples_without_wrap_s16(sink, dst);
|
shorts_dst = audio_stream_samples_without_wrap_s16(sink, dst);
|
||||||
shorts_copied = AE_MIN_32_signed(shorts_src, shorts_dst);
|
shorts_copied = AE_MIN32(shorts_src, shorts_dst);
|
||||||
shorts_copied = AE_MIN_32_signed(shorts, shorts_copied);
|
shorts_copied = AE_MIN32(shorts, shorts_copied);
|
||||||
m = shorts_copied >> 2;
|
m = shorts_copied >> 2;
|
||||||
left = shorts_copied & 0x03;
|
left = shorts_copied & 0x03;
|
||||||
inu = AE_LA64_PP(src);
|
inu = AE_LA64_PP(src);
|
||||||
|
|
Loading…
Reference in New Issue