mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-10 09:44:13 +00:00
dart: Add checks to dart_translate_internal()
Previous assumptions are not longer true with dart8110 on M2. Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
parent
c3c29bbd92
commit
93abc760b2
1 changed files with 10 additions and 0 deletions
10
src/dart.c
10
src/dart.c
|
@ -587,6 +587,16 @@ static void *dart_translate_internal(dart_dev_t *dart, uintptr_t iova, int silen
|
|||
u32 ttbr = (iova >> 36) & 0x3;
|
||||
u32 l1_index = (iova >> 25) & 0x7ff;
|
||||
|
||||
if ((int)ttbr >= dart->params->ttbr_count) {
|
||||
printf("dart[%lx %u]: ttbr out of range: %d\n", dart->regs, dart->device, ttbr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!dart->l1[ttbr]) {
|
||||
printf("dart[%lx %u]: l1[%u] is not set\n", dart->regs, dart->device, ttbr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(dart->l1[ttbr][l1_index] & DART_PTE_VALID) && !silent) {
|
||||
printf("dart[%lx %u]: l1 translation failure %x %lx\n", dart->regs, dart->device, l1_index,
|
||||
iova);
|
||||
|
|
Loading…
Reference in a new issue