mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-24 23:53:04 +00:00
dart: Fix parsing of variable lenght "vm-base" property
Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
parent
dfffdf6609
commit
56feda2b5e
1 changed files with 16 additions and 3 deletions
19
src/dart.c
19
src/dart.c
|
@ -320,9 +320,22 @@ dart_dev_t *dart_init_adt(const char *path, int instance, int device, bool keep_
|
|||
dart->l1[i]);
|
||||
}
|
||||
}
|
||||
if (ADT_GETPROP(adt, node, "vm-base", &dart->vm_base) < 0)
|
||||
dart->vm_base = 0;
|
||||
else
|
||||
u32 len;
|
||||
const void *prop = adt_getprop(adt, node, "vm-base", &len);
|
||||
if (prop) {
|
||||
if (len == sizeof(u32)) {
|
||||
u32 tmp;
|
||||
memcpy(&tmp, prop, sizeof(tmp));
|
||||
dart->vm_base = tmp;
|
||||
} else if (len == sizeof(u64)) {
|
||||
u64 tmp;
|
||||
memcpy(&tmp, prop, sizeof(tmp));
|
||||
dart->vm_base = tmp;
|
||||
} else {
|
||||
printf("dart: unexpected length of vm-base property: %u\n", len);
|
||||
}
|
||||
}
|
||||
if (dart->locked)
|
||||
dart->vm_base &= (1LLU << 36) - 1;
|
||||
|
||||
return dart;
|
||||
|
|
Loading…
Reference in a new issue