mmc: card: Fix packing control unit-tests
In case of TEST_PACKING_NOT_EXP_LESS_THAN_TRIGGER_REQUESTS and
TEST_PACKING_NOT_EXP_TRIGGER_REQUESTS packing is not expected and
the packing statistics array should not be updated.
Updating the array caused a memory corruption due to negative value
of num_packed_reqs
CRs-fixed: 379611
Change-Id: Ic57ff2bdb591603d2af5a87d5d36133f576e3bff
Signed-off-by: Maya Erez <merez@codeaurora.org>
diff --git a/drivers/mmc/card/mmc_block_test.c b/drivers/mmc/card/mmc_block_test.c
index 610a822..8165bf2 100644
--- a/drivers/mmc/card/mmc_block_test.c
+++ b/drivers/mmc/card/mmc_block_test.c
@@ -1191,9 +1191,9 @@
break;
case TEST_PACKING_NOT_EXP_LESS_THAN_TRIGGER_REQUESTS:
case TEST_PACKING_NOT_EXP_TRIGGER_REQUESTS:
- mbtd->exp_packed_stats.packing_events[num_packed_reqs] = 1;
break;
default:
+ BUG_ON(num_packed_reqs < 0);
mbtd->exp_packed_stats.pack_stop_reason[EMPTY_QUEUE] = 1;
mbtd->exp_packed_stats.packing_events[num_packed_reqs] = 1;
}