Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4157919pxk; Tue, 8 Sep 2020 12:09:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQzbYV0S+MBMHUP5LO70O6r94Wym0HmKPycDCfKtAdKu+QpdrF88TJxMWOgJehsfuWOlc8 X-Received: by 2002:a17:906:c0d1:: with SMTP id bn17mr26435276ejb.311.1599592164809; Tue, 08 Sep 2020 12:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599592164; cv=none; d=google.com; s=arc-20160816; b=N8Kp21bE3g+uEHy32nQ6gQUi3D/feHRU9F+E8LtBkbIKzr0C0+9udZDyh7q5GhROr9 3KPZ4/P9Cu3J5TtQkTR9P51hksIRCHJM3yc0SRjMJ7xB6wgvnlqDNV8lfIOdNAUzndQo d5IX02pppgqjNEZK41QSrhsWHN0vchxS41kHivgPL+HxcObUsPh77J+6A4yEGh9FzxCB Uug9IU+5e+0NY95pmH1aG4KQJjw8phuDP2QbsR6fSwbR9AFraFs5zOlbZVS5M4JgH6+u hY/2CkIjy9n7qysbQdDL7nYWL6mXkFpeLt55yIfTeUaxvTVlvb8HKQZ59yjPznq+tsbW MrVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mCUpSSo+0o4bOoEMHxfUow9cn1M6IX+noLnK4d9i+pE=; b=M/dfIocUPbZ/1Stp1Q69EpOjTWvYDGIUdDm48AkQzs3LlAuKUjWK4gNAY2XlPXdFD2 8TAqiCtd3baScEwVUCRtSM/GlCFn5u6eoYKrckdA0yN1MhaEpuPdyRIYYGCoxV6l2Ncn 1Oy4oVGFMNuUGJ//erx9CFd3QwK6cN9tWFXcnJiGcGvQOHSaBX6vUPkRmSAT8DYttld8 MlLY4cIKDzgx2BNW4AMiPGjpB+pwnEd29h85+qpfqtlIt1ataoRhRGAOS6z/Tb7/GL+Z yQjyy4OsTOYE0Fci6WQY4IaqNcQyix3CC/M3KViVlp69S9N/biLTmhV3l9FDeFPvdlfU SbFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jmAdHgut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s9si12325852eja.318.2020.09.08.12.09.02; Tue, 08 Sep 2020 12:09:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jmAdHgut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731625AbgIHTFT (ORCPT + 99 others); Tue, 8 Sep 2020 15:05:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:53446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730826AbgIHQHV (ORCPT ); Tue, 8 Sep 2020 12:07:21 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2348223E1F; Tue, 8 Sep 2020 15:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580011; bh=CANI4EdB3GWGdxXj0qd0YLgKhjSGCyb/d1FaCdaU570=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jmAdHgut50kH1P7umx3eQbhYA6b/DA868+g1Z+MHjLrxPqr7vX5Kq+nMyKO57feGZ KYZvU5ZHG9XHCT5uEtpmdAHA/hhSUGmhjmulyBMV/9ULKnkkzxtXYA5FHnabBCj5+Z id8gbC8OotDnFUFmBT64VmEL1iWMk/FMvGg7LK84= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mrinal Pandey , Andrew Morton , Lukas Bulwahn , Joe Perches , Linus Torvalds Subject: [PATCH 5.4 125/129] checkpatch: fix the usage of capture group ( ... ) Date: Tue, 8 Sep 2020 17:26:06 +0200 Message-Id: <20200908152236.103467555@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mrinal Pandey commit 13e45417cedbfc44b1926124b1846f5ee8c6ba4a upstream. The usage of "capture group (...)" in the immediate condition after `&&` results in `$1` being uninitialized. This issues a warning "Use of uninitialized value $1 in regexp compilation at ./scripts/checkpatch.pl line 2638". I noticed this bug while running checkpatch on the set of commits from v5.7 to v5.8-rc1 of the kernel on the commits with a diff content in their commit message. This bug was introduced in the script by commit e518e9a59ec3 ("checkpatch: emit an error when there's a diff in a changelog"). It has been in the script since then. The author intended to store the match made by capture group in variable `$1`. This should have contained the name of the file as `[\w/]+` matched. However, this couldn't be accomplished due to usage of capture group and `$1` in the same regular expression. Fix this by placing the capture group in the condition before `&&`. Thus, `$1` can be initialized to the text that capture group matches thereby setting it to the desired and required value. Fixes: e518e9a59ec3 ("checkpatch: emit an error when there's a diff in a changelog") Signed-off-by: Mrinal Pandey Signed-off-by: Andrew Morton Tested-by: Lukas Bulwahn Reviewed-by: Lukas Bulwahn Cc: Joe Perches Link: https://lkml.kernel.org/r/20200714032352.f476hanaj2dlmiot@mrinalpandey Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2576,8 +2576,8 @@ sub process { # Check if the commit log has what seems like a diff which can confuse patch if ($in_commit_log && !$commit_log_has_diff && - (($line =~ m@^\s+diff\b.*a/[\w/]+@ && - $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) || + (($line =~ m@^\s+diff\b.*a/([\w/]+)@ && + $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) || $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ || $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) { ERROR("DIFF_IN_COMMIT_MSG",