logging: int-uint comparsion causes false assert & epic hang #40115
Labels
area: Logging
bug
The issue is a bug, or the PR is fixing a bug
priority: low
Low impact/importance bug
Describe the bug
This piece of code
zephyr/subsys/logging/log_mgmt.c
Lines 185 to 202 in 963d05b
source_id
is int16_t and can take the value -1 according to the if statement. Now,z_log_sources_count()
returns uint32_t which causes a classical int-uint comparison causing the -1 to become UINT32_MAX when converted. This is what happened for me anyways.This in turn will trigger an assert, which in the assert will also be -1, which somehow causes the debugger to loose connection with target.
I want to make a PR for this, but my question for this is how to solve this in the best way? Typecase the
z_log_sources_count()
to int before comparing?The text was updated successfully, but these errors were encountered: