google_bms: fix idx size overflow
Bug: 333629531
Change-Id: I16f8b5259106b5f7dbfc7b16d896174d1a3fa206
Signed-off-by: Jenny Ho <hsiufangho@google.com>
(cherry picked from commit 11a05eccc1df6e819bc4290ec0b06c64253bafeb)
diff --git a/google_bms.c b/google_bms.c
index fc2f171..992da87 100644
--- a/google_bms.c
+++ b/google_bms.c
@@ -275,7 +275,7 @@
if (profile->aacr_nb_limits == 0 || cycles < 0)
return -EINVAL;
- for (idx = 0; idx < profile->aacr_nb_limits; idx++)
+ for (idx = 0; idx < profile->aacr_nb_limits - 1; idx++)
if (cycles < profile->reference_cycles[idx])
break;