Merge pull request #948 from riscv/uninitialized_dump
target/riscv: Prevent dump_field() reading uninitialized memory
This commit is contained in:
commit
51679e3e6b
|
@ -354,6 +354,8 @@ static unsigned int decode_dm(char *text, unsigned int address, unsigned int dat
|
|||
context, data);
|
||||
}
|
||||
}
|
||||
if (text)
|
||||
text[0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -361,8 +363,11 @@ static unsigned int decode_dmi(struct target *target, char *text, unsigned int a
|
|||
unsigned int data)
|
||||
{
|
||||
dm013_info_t *dm = get_dm(target);
|
||||
if (!dm)
|
||||
if (!dm) {
|
||||
if (text)
|
||||
text[0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
return decode_dm(text, address - dm->base, data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue