summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriele Monaco <gmonaco@redhat.com>2026-05-14 17:20:43 +0200
committerGabriele Monaco <gmonaco@redhat.com>2026-06-04 16:44:25 +0200
commitba0247c5aa3fcb2890a92a97a88c70fe5ce704a6 (patch)
tree3d0bd64f941946f5f0e651d18e8c9eb8c1127dda
parenta963fbf3166f2e178ac38b6c3c186a0c98092fb9 (diff)
tools/rv: Fix substring match when listing container monitors
When listing monitors within a specific container (rv list <container>), the tool incorrectly matched monitors if the requested container name was only a prefix of the actual container (e.g., 'rv list sche' would incorrectly list monitors from 'sched:'). Fix this by ensuring the container name is an exact match and is immediately followed by the ':' separator. Fixes: eba321a16fc6 ("tools/rv: Add support for nested monitors") Reviewed-by: Nam Cao <namcao@linutronix.de> Link: https://lore.kernel.org/r/20260514152055.229162-3-gmonaco@redhat.com Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
-rw-r--r--tools/verification/rv/src/in_kernel.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c
index 95eac9ab1484..e4f35940374f 100644
--- a/tools/verification/rv/src/in_kernel.c
+++ b/tools/verification/rv/src/in_kernel.c
@@ -193,8 +193,12 @@ static int ikm_fill_monitor_definition(char *name, struct monitor *ikm, char *co
nested_name = strstr(name, ":");
if (nested_name) {
/* it belongs in container if it starts with "container:" */
- if (container && strstr(name, container) != name)
- return 1;
+ if (container) {
+ int len = strlen(container);
+
+ if (strncmp(name, container, len) || name[len] != ':')
+ return 1;
+ }
*nested_name = '/';
++nested_name;
ikm->nested = 1;