From 6f474716432ca3ddae2ce989d9cdcdc9145c3959 Mon Sep 17 00:00:00 2001 From: Thomas Devoogdt Date: Sat, 16 Nov 2024 20:55:37 +0100 Subject: [PATCH] lib: cprofiles: fix wrong pointer assignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wrong struct types were used. Typo? /home/thomas/br-test-pkg/bootlin-armv7-glibc/build/fluent-bit-3.2.0/lib/cprofiles/src/cprof_profile.c: In function ‘cprof_profile_destroy’: /home/thomas/br-test-pkg/bootlin-armv7-glibc/build/fluent-bit-3.2.0/lib/cprofiles/src/cprof_profile.c:160:18: error: assignment to ‘struct cprof_mapping *’ from incompatible pointer type ‘struct cprof_location *’ [-Wincompatible-pointer-types] 160 | location = cfl_list_entry(iterator, | ^ /home/thomas/br-test-pkg/bootlin-armv7-glibc/build/fluent-bit-3.2.0/lib/cprofiles/src/cprof_profile.c:166:32: error: passing argument 1 of ‘cprof_location_destroy’ from incompatible pointer type [-Wincompatible-pointer-types] 166 | cprof_location_destroy(location); | ^~~~~~~~ | | | struct cprof_mapping * In file included from /home/thomas/br-test-pkg/bootlin-armv7-glibc/build/fluent-bit-3.2.0/lib/cprofiles/src/cprof_profile.c:21: /home/thomas/br-test-pkg/bootlin-armv7-glibc/build/fluent-bit-3.2.0/lib/cprofiles/include/cprofiles/cprofiles.h:304:52: note: expected ‘struct cprof_location *’ but argument is of type ‘struct cprof_mapping *’ 304 | void cprof_location_destroy(struct cprof_location *instance); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ Upstream: https://github.com/fluent/cprofiles/pull/3 Signed-off-by: Thomas Devoogdt --- lib/cprofiles/src/cprof_encode_text.c | 6 +++--- lib/cprofiles/src/cprof_profile.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/cprofiles/src/cprof_encode_text.c b/lib/cprofiles/src/cprof_encode_text.c index 218a72b5b..ab2d6247d 100644 --- a/lib/cprofiles/src/cprof_encode_text.c +++ b/lib/cprofiles/src/cprof_encode_text.c @@ -1909,7 +1909,7 @@ static int encode_cprof_resource_profiles( struct cprof_resource_profiles *instance) { int result; struct cfl_list *iterator; - struct cprof_scope_profile *scope_profile; + struct cprof_scope_profiles *scope_profiles; result = encode_string(context, CFL_TRUE, @@ -1958,11 +1958,11 @@ static int encode_cprof_resource_profiles( cfl_list_foreach(iterator, &instance->scope_profiles) { - scope_profile = cfl_list_entry( + scope_profiles = cfl_list_entry( iterator, struct cprof_scope_profiles, _head); - result = encode_cprof_scope_profiles(context, scope_profile); + result = encode_cprof_scope_profiles(context, scope_profiles); if (result != CPROF_ENCODE_TEXT_SUCCESS) { return result; diff --git a/lib/cprofiles/src/cprof_profile.c b/lib/cprofiles/src/cprof_profile.c index 66d62b361..931457ef7 100644 --- a/lib/cprofiles/src/cprof_profile.c +++ b/lib/cprofiles/src/cprof_profile.c @@ -98,7 +98,7 @@ void cprof_profile_destroy(struct cprof_profile *instance) struct cfl_list *iterator_backup; struct cprof_attribute_unit *attribute_unit; struct cprof_value_type *value_type; - struct cprof_mapping *location; + struct cprof_location *location; struct cprof_function *function; struct cfl_list *iterator; struct cprof_mapping *mapping; @@ -307,4 +307,4 @@ int cprof_profile_add_comment(struct cprof_profile *profile, int64_t comment) profile->comments_count++; return 0; -} \ No newline at end of file +} -- 2.43.0