diff mbox series

[meta-oe,1/4] dlt-daemon: fix sign-conversion warning in dlt_timer_conn_types array type

Message ID 20260418135209.1635971-1-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe,1/4] dlt-daemon: fix sign-conversion warning in dlt_timer_conn_types array type | expand

Commit Message

Khem Raj April 18, 2026, 1:52 p.m. UTC
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 .../dlt-daemon/char_conversion.patch          | 27 +++++++++++++++++++
 .../dlt-daemon/dlt-daemon_3.0.0.bb            |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 meta-oe/recipes-extended/dlt-daemon/dlt-daemon/char_conversion.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/dlt-daemon/dlt-daemon/char_conversion.patch b/meta-oe/recipes-extended/dlt-daemon/dlt-daemon/char_conversion.patch
new file mode 100644
index 0000000000..8d943b9764
--- /dev/null
+++ b/meta-oe/recipes-extended/dlt-daemon/dlt-daemon/char_conversion.patch
@@ -0,0 +1,27 @@ 
+daemon: fix sign-conversion warning in dlt_timer_conn_types array type
+
+Change dlt_timer_conn_types from char[] to DltConnectionType[] to match
+the actual type of values stored in the array.
+
+This was silently working on arm64 because char is unsigned by default on
+that architecture, making it compatible with DltConnectionType (an unsigned
+enum). On x86_64, char is signed by default, causing an implicit signed-to-
+unsigned conversion when passing array elements to dlt_connection_create(),
+which triggered -Wsign-conversion and broke the build.
+
+The fix corrects the array's declared type to match its contents, making the
+code portable regardless of the platform's char signedness.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
+--- a/src/daemon/dlt-daemon.c
++++ b/src/daemon/dlt-daemon.c
+@@ -140,7 +140,7 @@ int g_signo = 0;
+ /* used for value from conf file */
+ static int value_length = 1024;
+
+-static char dlt_timer_conn_types[DLT_TIMER_UNKNOWN + 1] = {
++static DltConnectionType dlt_timer_conn_types[DLT_TIMER_UNKNOWN + 1] = {
+     [DLT_TIMER_PACKET] = DLT_CONNECTION_ONE_S_TIMER,
+     [DLT_TIMER_ECU] = DLT_CONNECTION_SIXTY_S_TIMER,
+ #ifdef DLT_SYSTEMD_WATCHDOG_ENABLE
diff --git a/meta-oe/recipes-extended/dlt-daemon/dlt-daemon_3.0.0.bb b/meta-oe/recipes-extended/dlt-daemon/dlt-daemon_3.0.0.bb
index cbeb8c3703..6de62c2a3d 100644
--- a/meta-oe/recipes-extended/dlt-daemon/dlt-daemon_3.0.0.bb
+++ b/meta-oe/recipes-extended/dlt-daemon/dlt-daemon_3.0.0.bb
@@ -25,6 +25,7 @@  SRC_URI = "git://github.com/COVESA/${BPN}.git;protocol=https;branch=master \
            file://0001-CMakeLists.txt-make-CONFIGURATION_FILES_DIR-aligned.patch \
            file://0001-warnings-Fix-clang-generated-warnings.patch \
            file://0001-dlt-daemon.c-fix-wrong-len.patch \
+           file://char_conversion.patch \
            "
 SRCREV = "f595ea29d1007ca1c3b2d1fd3a88adf7d3db6320"