Skip to content

Commit

Permalink
prefcnt: cus__load_files() requires a non NULL conf_load
Browse files Browse the repository at this point in the history
Since ff7bd70 ("core: Allow sizing the loader hash table")
dwarf__load_files(), called by cus__load_files() needs a non-NULL
conf_load argument, add one to avoid a core dump.

J B reported this for syscse, which led me to do a quick audit to find
this other case.

Reported-by: J B <[email protected]>
Link: https://lore.kernel.org/dwarves/CAJXMFhFbv5MccigKvmQt9MhYwKv2iyigEG3Bhs64BZ=PMWc0WQ@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Feb 27, 2024
1 parent f86ed77 commit 90201c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion prefcnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
#include "dwarves.h"
#include "dutil.h"

static struct conf_fprintf conf;

static struct conf_load conf_load = {
.conf_fprintf = &conf,
};

static void refcnt_tag(struct tag *tag, const struct cu *cu);

static void refcnt_member(struct class_member *member, const struct cu *cu)
Expand Down Expand Up @@ -143,7 +149,7 @@ int main(int argc __maybe_unused, char *argv[])

dwarves__resolve_cacheline_size(NULL, 0);

err = cus__load_files(cus, NULL, argv + 1);
err = cus__load_files(cus, &conf_load, argv + 1);
if (err != 0) {
cus__fprintf_load_files_err(cus, "prefcnt", argv + 1, err, stderr);
return EXIT_FAILURE;
Expand Down

0 comments on commit 90201c2

Please sign in to comment.