]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
lib: glob: replace bitwise OR with logical operation on boolean
authorJosh Law <objecting@objecting.org>
Sun, 1 Mar 2026 15:21:42 +0000 (15:21 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 28 Mar 2026 04:19:37 +0000 (21:19 -0700)
Using bitwise OR (|=) on a boolean variable is valid C, but replacing it
with a direct logical assignment makes the intent clearer and appeases
strict static analysis tools.

Link: https://lkml.kernel.org/r/20260301152143.2572137-2-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 44a8d5e4e99b3e37d0dda58a39b224a0d17d02a9..877bdd0884a6163048a7962087cf4013b90a6439 100644 (file)
@@ -96,7 +96,8 @@ bool __pure glob_match(char const *pat, char const *str)
                                        class += 2;
                                        /* Any special action if a > b? */
                                }
-                               match |= (a <= c && c <= b);
+                               if (a <= c && c <= b)
+                                       match = true;
                        } while ((a = *class++) != ']');
 
                        if (match == inverted)