mirror of
https://github.com/CTCaer/hekate
synced 2024-11-04 19:06:35 +00:00
bdk: nx emmc bis: fix out of cluster bounds accesses
This commit is contained in:
parent
6666dd4b46
commit
52bb6a96e5
1 changed files with 12 additions and 2 deletions
|
@ -251,7 +251,12 @@ int nx_emmc_bis_read(u32 sector, u32 count, void *buff)
|
|||
|
||||
while (count)
|
||||
{
|
||||
u32 sct_cnt = MIN(count, BIS_CLUSTER_SECTORS);
|
||||
// Get sector index in cluster and use it as boundary check.
|
||||
u32 cnt_max = (curr_sct % BIS_CLUSTER_SECTORS);
|
||||
cnt_max = BIS_CLUSTER_SECTORS - cnt_max;
|
||||
|
||||
u32 sct_cnt = MIN(count, cnt_max); // Only allow cluster sized access.
|
||||
|
||||
if (nx_emmc_bis_read_block(curr_sct, sct_cnt, buf))
|
||||
return 0;
|
||||
|
||||
|
@ -270,7 +275,12 @@ int nx_emmc_bis_write(u32 sector, u32 count, void *buff)
|
|||
|
||||
while (count)
|
||||
{
|
||||
u32 sct_cnt = MIN(count, BIS_CLUSTER_SECTORS);
|
||||
// Get sector index in cluster and use it as boundary check.
|
||||
u32 cnt_max = (curr_sct % BIS_CLUSTER_SECTORS);
|
||||
cnt_max = BIS_CLUSTER_SECTORS - cnt_max;
|
||||
|
||||
u32 sct_cnt = MIN(count, cnt_max); // Only allow cluster sized access.
|
||||
|
||||
if (nx_emmc_bis_write_block(curr_sct, sct_cnt, buf, false))
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue