public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Josh Law <hlcj1234567@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Josh Law <objecting@objecting.org>
Subject: [PATCH] lib/glob: initialize back_str to silence uninitialized variable warning
Date: Thu, 12 Mar 2026 21:52:49 +0000	[thread overview]
Message-ID: <20260312215249.50165-1-objecting@objecting.org> (raw)

From: Josh Law <objecting@objecting.org>

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.

Signed-off-by: Josh Law <objecting@objecting.org>
---
 lib/glob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/glob.c b/lib/glob.c
index 69311568ad3d..7aca76c25bcb 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -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
-- 
2.34.1


             reply	other threads:[~2026-03-12 21:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 21:52 Josh Law [this message]
2026-03-12 22:46 ` [PATCH] lib/glob: initialize back_str to silence uninitialized variable warning Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260312215249.50165-1-objecting@objecting.org \
    --to=hlcj1234567@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=objecting@objecting.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox