Files
u-boot/include
Ian Roberts 5f07144968 mmc: sdhci: Fix potential ADMA descriptor table overflow
Change ADMA_TABLE_NO_ENTRIES to round the division up to fully
contain CONFIG_SYS_MMC_MAX_BLK_COUNT, fixing potential buffer overflow
of the ADMA descriptor table.

sdhci_prepare_adma_table() expecitily states it does _not_ check for
overflow as the descriptor table size is dependent on
CONFIG_SYS_MMC_MAX_BLK_COUNT. However, the ADMA_TABLE_NO_ENTRIES
calculation does not round up the divison, so with the current u-boot
 defaults:
max_mmc_transfer = (CONFIG_SYS_MMC_MAX_BLK_COUNT * MMC_MAX_BLOCK_LEN) =
65535 * 512 = 33553920 bytes.
ADMA_TABLE_NO_ENTRIES = max_mmc_transfer / ADMA_MAX_LEN =
33553920 / 65532, which does not divide cleanly.
actual_max_transfer = ADMA_TABLE_NO_ENTRIES * ADMA_MAX_LEN = 512 *
65532 = 33552384, which is smaller than max_mmc_transfer.
This can cause sdhci_prepare_adma_table() to write one extra
descriptor, overflowing the table when a transaction larger than
actual_max_transfer is issued.

Co-developed-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Greg Malysa <greg.malysa@timesys.com>
Signed-off-by: Ian Roberts <ian.roberts@timesys.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2024-04-26 15:31:00 +09:00
..
2024-01-03 09:22:47 -05:00
2024-03-14 18:19:44 +08:00
2023-08-25 13:54:33 -04:00
2023-08-08 10:22:03 -04:00
2023-12-21 08:54:37 -05:00
2023-12-13 11:51:24 -05:00
2024-02-13 15:38:49 -05:00
2024-01-29 22:35:02 -05:00
2024-04-21 09:07:00 +02:00
2023-10-23 17:07:06 +03:00
2023-11-07 14:50:51 -05:00
2024-01-13 18:17:47 +01:00
2023-12-21 08:54:37 -05:00
2023-10-31 09:08:51 +01:00
2024-03-01 14:44:35 +00:00
2023-12-21 11:59:49 -05:00
2023-08-19 04:12:53 +02:00
2023-12-13 11:35:13 -05:00
2023-12-21 08:54:37 -05:00
2023-10-11 15:43:55 -04:00
2024-04-15 15:19:12 +09:00
2023-11-16 12:43:49 -05:00
2023-12-21 08:54:37 -05:00
2023-11-18 10:08:09 +02:00
2024-03-26 19:58:26 -04:00
2024-03-26 19:58:26 -04:00
2023-12-21 08:54:37 -05:00
2023-10-15 12:23:48 +02:00
2024-03-27 09:23:30 +01:00
2023-11-16 13:49:14 -05:00
2023-10-09 15:24:31 -04:00
2023-10-27 13:14:47 +03:00
2023-11-14 20:04:00 -07:00