Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] Unquoted variable in helper function `search_trace` truncates the 
search pattern if it contains spaces.
--

commit 35e29a827e53195f855e4fc5d139746aeb606df3
Author: Jim Cromie <[email protected]>

selftests-dyndbg: add a dynamic_debug run_tests target

This commit adds a dynamic-debug selftest script and basic test targets
for the dynamic_debug subsystem. It introduces tests that modify pr_debug()
flags and verify their effects in the control interface.

> diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh 
> b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
> new file mode 100755
> index 0000000000000..8b2b7388678e3
> --- /dev/null
> +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
[ ... ]
> +function ifrmmod {
> +    lsmod | grep $1 2>&1>/dev/null && rmmod $1
> +}
> +
> +# $1 - text to search for
> +function search_trace() {
> +    search_trace_name 0 1 $1

[Severity: Low]
Does this unquoted variable truncate the search pattern if it contains
spaces?

If search_trace() is called with a multi-word string like
search_trace "error message", word splitting will cause
search_trace_name() to receive "error" as the third parameter and
"message" as a fourth parameter. Since search_trace_name() only uses
$3 for its grep pattern, it will only search for the first word.

Could this be fixed by quoting "$1" instead?

> +}
> +
> +# $1 - trace instance name, 0 for global event trace
> +# $2 - line number counting from the bottom
> +# $3 - text to search for
> +function search_trace_name() {
[ ... ]

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=22

Reply via email to