Commit 720c29fc authored by Alan Maguire's avatar Alan Maguire Committed by Andrii Nakryiko
Browse files

libbpf: Propagate errors when retrieving enum value for typed data display



When retrieving the enum value associated with typed data during
"is data zero?" checking in btf_dump_type_data_check_zero(), the
return value of btf_dump_get_enum_value() is not passed to the caller
if the function returns a non-zero (error) value.  Currently, 0
is returned if the function returns an error.  We should instead
propagate the error to the caller.

Signed-off-by: default avatarAlan Maguire <alan.maguire@oracle.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/1626770993-11073-4-git-send-email-alan.maguire@oracle.com
parent a17553dd
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2166,8 +2166,9 @@ static int btf_dump_type_data_check_zero(struct btf_dump *d,
		return -ENODATA;
	}
	case BTF_KIND_ENUM:
		if (btf_dump_get_enum_value(d, t, data, id, &value))
			return 0;
		err = btf_dump_get_enum_value(d, t, data, id, &value);
		if (err)
			return err;
		if (value == 0)
			return -ENODATA;
		return 0;