dwarf_loader: Fix elfutils dwfl_getmodules() error checking

The dwfl_getmodules() functions in elfutils returns a negative value for
errors, and an offset to continue processing multi module files, fix it
to avoid printing a misleading EINVAL error since:

  f952a6f69f9508c8 ("pahole: Avoid segfault when parsing bogus file")

This:

  ⬢[acme@toolbox pahole]$ pahole -C xfrm_tmpl tcp.o
  struct xfrm_tmpl {
  	struct xfrm_id             id;                   /*     0    24 */

  	/* XXX last struct has 3 bytes of padding */

  	xfrm_address_t             saddr;                /*    24    16 */
  	short unsigned int         encap_family;         /*    40     2 */

  	/* XXX 2 bytes hole, try to pack */

  	u32                        reqid;                /*    44     4 */
  	u8                         mode;                 /*    48     1 */
  	u8                         share;                /*    49     1 */
  	u8                         optional;             /*    50     1 */
  	u8                         allalgs;              /*    51     1 */
  	u32                        aalgos;               /*    52     4 */
  	u32                        ealgos;               /*    56     4 */
  	u32                        calgos;               /*    60     4 */

  	/* size: 64, cachelines: 1, members: 11 */
  	/* sum members: 62, holes: 1, sum holes: 2 */
  	/* paddings: 1, sum paddings: 3 */
  };
  pahole: tcp.o: Invalid argument <--------------------------------------------
  ⬢[acme@toolbox pahole]$

Cc: Kornilios Kourtis <kornilios@isovalent.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed