From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0FFB366070 for ; Thu, 12 Mar 2026 22:46:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773355615; cv=none; b=E4DmVp9jEKVZMmYRMBTCw44La/HlAuYXc0CT7nBSFIuWt8zJGJKORQoGIB4Atdy1bUdxGfrV8lGWAU2cej85atTkJmewbEX+rAUPdD0hssvYK+wSDG7M0kR0MHWtR75/hDz8dW7KQvEPeOntCzpDbFYUfEVJR7Cv+FXtnQHFvvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773355615; c=relaxed/simple; bh=wrUm57cBRAnd6ljAlEHKgFCfh00HbcvkQdCNQl1/Rdk=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=pLtvRkNAEzRhhga7qCOMpu+3ygimOc1/q6HMiOixDKxZlIzoNXr0wTSG0gNOFVqcwNGqLZtc9N715UZrfGA6sKq6kXWM98kRUkp6r4S3wFK4FnyPRtZBj/JWJ/A+r6xEJLEzuzVXGDWzUNebT5vPZTIY2CsIO5T1L0Yv4iqtjGo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=QVCMK7TN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="QVCMK7TN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CCF0C4CEF7; Thu, 12 Mar 2026 22:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1773355615; bh=wrUm57cBRAnd6ljAlEHKgFCfh00HbcvkQdCNQl1/Rdk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QVCMK7TNTdp3YoYEiVTcl9oy7yLDCbRRQwuK5YxCu0SlolpnMLYMwgIpC77HVatel KBovQtFRUPdMDLBoL3swKbdKiU2xzRRQGsjf68IVV9nnqc/b7HForMbH5IK/CNN+xz 0+0j19nQMPrKgoSO1MtNWlZ+gkFBGLlfxhZR4Ju0= Date: Thu, 12 Mar 2026 15:46:54 -0700 From: Andrew Morton To: Josh Law Cc: linux-kernel@vger.kernel.org, Josh Law Subject: Re: [PATCH] lib/glob: initialize back_str to silence uninitialized variable warning Message-Id: <20260312154654.cb240d04a038e92b17e3f190@linux-foundation.org> In-Reply-To: <20260312215249.50165-1-objecting@objecting.org> References: <20260312215249.50165-1-objecting@objecting.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 12 Mar 2026 21:52:49 +0000 Josh Law wrote: > 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. > > ... > > --- 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; > I can certainly believe that some compiler versions will warn about this, but please always quote the warning/error message when fixing such things.