Commit 90ab94f6 authored by Krzysztof Chruściński's avatar Krzysztof Chruściński Committed by Anas Nashif
Browse files

logging: Do not store module name pointer when strings are stripped

When logging strings are stripped then addresses to log module
names are invalid. Do not store that address in the const
data structure associated with the logging module to avoid
someone accessing it. Store null instead.

Signed-off-by: default avatarKrzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
parent a7970062
Loading
Loading
Loading
Loading
+2 −1
Changes for include/zephyr/logging/log.h: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -328,7 +328,8 @@ void z_log_vprintk(const char *fmt, va_list ap);
		log_source_const_data,								\
		Z_LOG_ITEM_CONST_DATA(_name)) =							\
	{											\
		.name = COND_CODE_1(CONFIG_LOG_FMT_SECTION,					\
		.name = IS_ENABLED(LOG_FMT_SECTION_STRIP) ? NULL :				\
			COND_CODE_1(CONFIG_LOG_FMT_SECTION,					\
				(UTIL_CAT(_name, _str)), (STRINGIFY(_name))),			\
		.level = (_level)								\
	}