logging: shell: fix shell stats null pointer dereference
If CONFIG_SHELL_STATS is disabled, shell->stats is NULL and must not be dereferenced. Guard against it. Fixes #44089 Signed-off-by: Alexej Rempel <Alexej.Rempel@de.eckerle-gruppe.com>
This commit is contained in:
parent
5d662ae3f8
commit
476d199752
|
@ -320,7 +320,9 @@ static void dropped(const struct log_backend *const backend, uint32_t cnt)
|
|||
const struct shell *shell = (const struct shell *)backend->cb->ctx;
|
||||
const struct shell_log_backend *log_backend = shell->log_backend;
|
||||
|
||||
atomic_add(&shell->stats->log_lost_cnt, cnt);
|
||||
if (IS_ENABLED(CONFIG_SHELL_STATS)) {
|
||||
atomic_add(&shell->stats->log_lost_cnt, cnt);
|
||||
}
|
||||
atomic_add(&log_backend->control_block->dropped_cnt, cnt);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue