Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpio: shell: fix a crash where there's less line names than gpios #85890

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

fabiobaltieri
Copy link
Member

Fix a potential gpio shell command crash, sneak in two other cleanups too.

Move SHELL_DYNAMIC_CMD_CREATE after the function, then the forward
declaration is unnecessary.

Signed-off-by: Fabio Baltieri <[email protected]>
line_cmp is only used in this file, make it static.

Signed-off-by: Fabio Baltieri <[email protected]>
Don't try to dereference line_names if the index is beyond
line_names_len, this can happen if there's less line names than the
total amount of supported gpios specified.

Signed-off-by: Fabio Baltieri <[email protected]>
@fabiobaltieri fabiobaltieri added this to the v4.1.0 milestone Feb 17, 2025
@fabiobaltieri fabiobaltieri marked this pull request as ready for review February 17, 2025 17:15
@kartben kartben merged commit a3bd7ef into zephyrproject-rtos:main Feb 19, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants