]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
lib/glob: initialize back_str to silence uninitialized variable warning
authorJosh Law <objecting@objecting.org>
Thu, 12 Mar 2026 21:52:49 +0000 (21:52 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 28 Mar 2026 04:19:45 +0000 (21:19 -0700)
back_str is only used when back_pat is non-NULL, and both are always set
together, so it is safe in practice.  Initialize back_str to NULL to make
this safety invariant explicit and silence compiler/static analysis
warnings.

Link: https://lkml.kernel.org/r/20260312215249.50165-1-objecting@objecting.org
Signed-off-by: Josh Law <objecting@objecting.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/glob.c

index 69311568ad3dc75265b6b421ce27c0393b4012ff..7aca76c25bcb2210d84cf556b576ebf0a85e7c96 100644 (file)
@@ -47,7 +47,7 @@ bool __pure glob_match(char const *pat, char const *str)
         * (no exception for /), it can be easily proved that there's
         * never a need to backtrack multiple levels.
         */
-       char const *back_pat = NULL, *back_str;
+       char const *back_pat = NULL, *back_str = NULL;
 
        /*
         * Loop over each token (character or class) in pat, matching