dwarf_loader: Check if we have a CU after the loop in cus__merge_and_process_cu()
Theoretically possible, silences covscan/gcc analyser: Error: GCC_ANALYZER_WARNING (CWE-476): dwarves-1.21/dwarf_loader.c:2218:27: warning[-Wanalyzer-null-dereference]: dereference of NULL 'cu' # 2216| uint32_t i; # 2217| # 2218|-> for (i = 0; i < pt->nr_entries; ++i) { # 2219| struct tag *tag = pt->entries[i]; # 2220| Error: CLANG_WARNING: dwarves-1.21/dwarf_loader.c:2245:13: warning[core.NullDereference]: Access to field 'nr_entries' results in a dereference of a null pointer (loaded from variable 'pt') # 2243| uint32_t i) # 2244| { # 2245|-> for (; i < pt->nr_entries; ++i) { # 2246| struct tag *tag = pt->entries[i]; Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
2f30062b54
commit
25cc0c7754
|
@ -2670,6 +2670,9 @@ static int cus__merge_and_process_cu(struct cus *cus, struct conf_load *conf,
|
|||
off = noff;
|
||||
}
|
||||
|
||||
if (cu == NULL)
|
||||
return 0;
|
||||
|
||||
/* process merged cu */
|
||||
if (cu__recode_dwarf_types(cu) != LSK__KEEPIT)
|
||||
return DWARF_CB_ABORT;
|
||||
|
|
Loading…
Reference in New Issue