Skip to content

Conversation

@tpambor
Copy link
Contributor

@tpambor tpambor commented Jun 17, 2025

Update the str_out function signature to match the expected cbprintf_cb_local type.

/* Create local cbprintf_cb type to make calng-based compilers happy when handles
 * OUTC() macro (see below). With strict rules (Wincompatible-function-pointer-types-strict)
 * it's prohibited to pass arguments with mismatched types.
 */
typedef int (*cbprintf_cb_local)(int c, void *ctx);

This fixes the following runtime error generated by UBSAN:

zephyr/lib/os/cbprintf_complete.c:1409:4: runtime error: call to function str_out through pointer to incorrect function type 'int (*)(int, void *)'
zephyr/lib/os/printk.c:214: note: str_out defined here

@github-actions github-actions bot added the area: Base OS Base OS Library (lib/os) label Jun 17, 2025
Update the str_out function signature to match the expected
cbprintf_cb_local type:
typedef int (*cbprintf_cb_local)(int c, void *ctx);

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
@tpambor tpambor force-pushed the fix-printk-str-out branch from 0287343 to f4b24f9 Compare June 17, 2025 17:18
@sonarqubecloud
Copy link

@nashif nashif added the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label Jun 18, 2025
@nashif nashif merged commit 3b90ed6 into zephyrproject-rtos:main Jun 18, 2025
32 checks passed
@ghost ghost mentioned this pull request Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Base OS Base OS Library (lib/os) Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants