2
1

0007-lib-cprofiles-fix-wrong-pointer-assignment.patch 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. From 6f474716432ca3ddae2ce989d9cdcdc9145c3959 Mon Sep 17 00:00:00 2001
  2. From: Thomas Devoogdt <thomas@devoogdt.com>
  3. Date: Sat, 16 Nov 2024 20:55:37 +0100
  4. Subject: [PATCH] lib: cprofiles: fix wrong pointer assignment
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. The wrong struct types were used. Typo?
  9. /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’:
  10. /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]
  11. 160 | location = cfl_list_entry(iterator,
  12. | ^
  13. /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]
  14. 166 | cprof_location_destroy(location);
  15. | ^~~~~~~~
  16. | |
  17. | struct cprof_mapping *
  18. 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:
  19. /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 *’
  20. 304 | void cprof_location_destroy(struct cprof_location *instance);
  21. | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
  22. Upstream: https://github.com/fluent/cprofiles/pull/3
  23. Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
  24. ---
  25. lib/cprofiles/src/cprof_encode_text.c | 6 +++---
  26. lib/cprofiles/src/cprof_profile.c | 4 ++--
  27. 2 files changed, 5 insertions(+), 5 deletions(-)
  28. diff --git a/lib/cprofiles/src/cprof_encode_text.c b/lib/cprofiles/src/cprof_encode_text.c
  29. index 218a72b5b..ab2d6247d 100644
  30. --- a/lib/cprofiles/src/cprof_encode_text.c
  31. +++ b/lib/cprofiles/src/cprof_encode_text.c
  32. @@ -1909,7 +1909,7 @@ static int encode_cprof_resource_profiles(
  33. struct cprof_resource_profiles *instance) {
  34. int result;
  35. struct cfl_list *iterator;
  36. - struct cprof_scope_profile *scope_profile;
  37. + struct cprof_scope_profiles *scope_profiles;
  38. result = encode_string(context,
  39. CFL_TRUE,
  40. @@ -1958,11 +1958,11 @@ static int encode_cprof_resource_profiles(
  41. cfl_list_foreach(iterator,
  42. &instance->scope_profiles) {
  43. - scope_profile = cfl_list_entry(
  44. + scope_profiles = cfl_list_entry(
  45. iterator,
  46. struct cprof_scope_profiles, _head);
  47. - result = encode_cprof_scope_profiles(context, scope_profile);
  48. + result = encode_cprof_scope_profiles(context, scope_profiles);
  49. if (result != CPROF_ENCODE_TEXT_SUCCESS) {
  50. return result;
  51. diff --git a/lib/cprofiles/src/cprof_profile.c b/lib/cprofiles/src/cprof_profile.c
  52. index 66d62b361..931457ef7 100644
  53. --- a/lib/cprofiles/src/cprof_profile.c
  54. +++ b/lib/cprofiles/src/cprof_profile.c
  55. @@ -98,7 +98,7 @@ void cprof_profile_destroy(struct cprof_profile *instance)
  56. struct cfl_list *iterator_backup;
  57. struct cprof_attribute_unit *attribute_unit;
  58. struct cprof_value_type *value_type;
  59. - struct cprof_mapping *location;
  60. + struct cprof_location *location;
  61. struct cprof_function *function;
  62. struct cfl_list *iterator;
  63. struct cprof_mapping *mapping;
  64. @@ -307,4 +307,4 @@ int cprof_profile_add_comment(struct cprof_profile *profile, int64_t comment)
  65. profile->comments_count++;
  66. return 0;
  67. -}
  68. \ No newline at end of file
  69. +}
  70. --
  71. 2.43.0