The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2] lib: parser: Fix match_wildcard to correctly handle trailing stars
@ 2026-03-26  2:06 Inseob Kim
  2026-03-26  2:25 ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Inseob Kim @ 2026-03-26  2:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: changbin.du, jbaron, joe, akpm, Inseob Kim

This fixes a bug of match_wildcard that incorrectly handles trailing
asterisks. For example, `match_wildcard("abc**", "abc")` must return
true, but it returns false.

Signed-off-by: Inseob Kim <inseob@google.com>
---
v2:
  - Added Cc. No changes to the code.
---
 lib/parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/parser.c b/lib/parser.c
index 73e8f8e5be73..62da0ac0d438 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -315,7 +315,7 @@ bool match_wildcard(const char *pattern, const char *str)
 		}
 	}
 
-	if (*p == '*')
+	while (*p == '*')
 		++p;
 	return !*p;
 }
-- 
2.53.0.1018.g2bb0e51243-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-03-27 15:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26  2:06 [PATCH v2] lib: parser: Fix match_wildcard to correctly handle trailing stars Inseob Kim
2026-03-26  2:25 ` Andrew Morton
2026-03-26  4:12   ` Inseob Kim
2026-03-26  4:45     ` Andrew Morton
2026-03-26  4:51       ` Inseob Kim
2026-03-27 10:11         ` Takaya Saeki
2026-03-27 15:17           ` Andrew Morton
2026-03-26  7:10   ` Josh Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox