Merge pull request #7232 from mikeller/fix_print_resource
Fixed NULL dereference in 'printResource'.
This commit is contained in:
commit
cfaabac125
|
@ -3977,23 +3977,24 @@ static void printResource(uint8_t dumpMask)
|
|||
}
|
||||
|
||||
for (int index = 0; index < MAX_RESOURCE_INDEX(resourceTable[i].maxIndex); index++) {
|
||||
const ioTag_t ioTag = *((const uint8_t *)currentConfig + resourceTable[i].stride * index + resourceTable[i].offset);
|
||||
const ioTag_t ioTagDefault = *((const uint8_t *)defaultConfig + resourceTable[i].stride * index + resourceTable[i].offset);
|
||||
const ioTag_t ioTag = *(ioTag_t *)((const uint8_t *)currentConfig + resourceTable[i].stride * index + resourceTable[i].offset);
|
||||
ioTag_t ioTagDefault = NULL;
|
||||
if (defaultConfig) {
|
||||
ioTagDefault = *(ioTag_t *)((const uint8_t *)defaultConfig + resourceTable[i].stride * index + resourceTable[i].offset);
|
||||
}
|
||||
|
||||
bool equalsDefault = ioTag == ioTagDefault;
|
||||
const bool equalsDefault = ioTag == ioTagDefault;
|
||||
const char *format = "resource %s %d %c%02d";
|
||||
const char *formatUnassigned = "resource %s %d NONE";
|
||||
if (!ioTagDefault) {
|
||||
cliDefaultPrintLinef(dumpMask, equalsDefault, formatUnassigned, owner, RESOURCE_INDEX(index));
|
||||
} else {
|
||||
if (ioTagDefault) {
|
||||
cliDefaultPrintLinef(dumpMask, equalsDefault, format, owner, RESOURCE_INDEX(index), IO_GPIOPortIdxByTag(ioTagDefault) + 'A', IO_GPIOPinIdxByTag(ioTagDefault));
|
||||
} else if (defaultConfig) {
|
||||
cliDefaultPrintLinef(dumpMask, equalsDefault, formatUnassigned, owner, RESOURCE_INDEX(index));
|
||||
}
|
||||
if (!ioTag) {
|
||||
if (!(dumpMask & HIDE_UNUSED)) {
|
||||
cliDumpPrintLinef(dumpMask, equalsDefault, formatUnassigned, owner, RESOURCE_INDEX(index));
|
||||
}
|
||||
} else {
|
||||
if (ioTag) {
|
||||
cliDumpPrintLinef(dumpMask, equalsDefault, format, owner, RESOURCE_INDEX(index), IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag));
|
||||
} else if (!(dumpMask & HIDE_UNUSED)) {
|
||||
cliDumpPrintLinef(dumpMask, equalsDefault, formatUnassigned, owner, RESOURCE_INDEX(index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue