Skip to content
Commit 96342211 authored by Alberto Escolar Piedras's avatar Alberto Escolar Piedras Committed by Chris Friedt
Browse files

driver gpio nrfx: Fix undefined output in gpio_nrfx_port_get_direction



gpio_nrfx_port_get_direction() is meant to check which inputs
are enabled, and does so by checking one bit at a time
and setting that bit into the "input" parameter.
But "input" was never zeroed, so any garbage ones it
may have remains.
Zero it.

This fixes a problem where if the "input" parameter was not
zeroed by the caller, the result of the funcion call
is undefined.

Detected by valgrind on:
tests/drivers/gpio/gpio_get_direction

Conditional jump or move depends on uninitialised value(s)
   by gpio_get_direction_test_disconnect (main.c:64)

Conditional jump or move depends on uninitialised value(s)
   by gpio_get_direction_test_output (main.c:102)

When running this test for the nrf52_bsim.

Signed-off-by: default avatarAlberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
parent eba4d34b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment