From 8adadca4830a2bd62b8547d049d8c1f08550171d Mon Sep 17 00:00:00 2001 From: Shriram Shastry Date: Sun, 23 Jun 2024 19:43:47 +0530 Subject: [PATCH] Audio: Bugfix: Correct loop boundary in line_array_mode_check Adjust loop boundary to ensure correct number of elements are processed. Signed-off-by: Shriram Shastry --- src/audio/tdfb/tdfb_direction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/tdfb/tdfb_direction.c b/src/audio/tdfb/tdfb_direction.c index f20c5410f0d9..8bb87a973406 100644 --- a/src/audio/tdfb/tdfb_direction.c +++ b/src/audio/tdfb/tdfb_direction.c @@ -157,7 +157,7 @@ static bool line_array_mode_check(struct tdfb_comp_data *cd) * Form vector AB(a,b,c) from x(i+1) - x(i), y(i+1) - y(i), z(i+1) - z(i) * Form vector AC(d,e,f) from x(i+2) - x(i), y(i+2) - y(1), z(i+2) - z(i) */ - for (i = 0; i < num_mic_locations - 3; i++) { + for (i = 0; i < num_mic_locations - 2; i++) { a = cd->mic_locations[i + 1].x - cd->mic_locations[i].x; b = cd->mic_locations[i + 1].y - cd->mic_locations[i].y; c = cd->mic_locations[i + 1].z - cd->mic_locations[i].z;