Skip to content

Commit

Permalink
tests: drivers: lpuart: Fix memory corruption
Browse files Browse the repository at this point in the history
Data allocated on stack was used as a user data passed to the
interrupt. By the time interrupt is handled this data could be
overwritten leading to a fault. Adding static keyword to that
variable.

Signed-off-by: Krzysztof Chruściński <[email protected]>
  • Loading branch information
nordic-krch authored and rlubos committed Nov 7, 2024
1 parent 31e08fd commit 077d132
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/drivers/lpuart/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ static void counter_alarm_callback(const struct device *dev,

static void floating_pins_start(int32_t tx_pin)
{
struct test_data data;
static struct test_data data;

data.alarm_cfg.callback = counter_alarm_callback;
data.alarm_cfg.flags = COUNTER_ALARM_CFG_EXPIRE_WHEN_LATE;
Expand Down

0 comments on commit 077d132

Please sign in to comment.