From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25D0EC433F5 for ; Wed, 24 Nov 2021 12:33:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245426AbhKXMgI (ORCPT ); Wed, 24 Nov 2021 07:36:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:49174 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245019AbhKXMeI (ORCPT ); Wed, 24 Nov 2021 07:34:08 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 083AF61378; Wed, 24 Nov 2021 12:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637756447; bh=LWheMsac2MLhKOBfcd9MAnPJyZJjzi9UNrW/13Um3tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JHcRaFSzUfCQBfR347C5Xs9FGJsrbblJZjfJDbQdRch9FUklQl49qm2rzQSSbEUMK 9QwKAjEGZtt0mAgzpgr77GB70s+UkwdD1e/znwZ++r0bg6CgGbquvWiGpd1hjnFcoL 9bFA6Ouo3Os/5uxrXinodZC7wfb5YhV1Yf3s30xA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 4.14 090/251] leaking_addresses: Always print a trailing newline Date: Wed, 24 Nov 2021 12:55:32 +0100 Message-Id: <20211124115713.375429420@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115710.214900256@linuxfoundation.org> References: <20211124115710.214900256@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kees Cook [ Upstream commit cf2a85efdade117e2169d6e26641016cbbf03ef0 ] For files that lack trailing newlines and match a leaking address (e.g. wchan[1]), the leaking_addresses.pl report would run together with the next line, making things look corrupted. Unconditionally remove the newline on input, and write it back out on output. [1] https://lore.kernel.org/all/20210103142726.GC30643@xsang-OptiPlex-9020/ Signed-off-by: Kees Cook Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20211008111626.151570317@infradead.org Signed-off-by: Sasha Levin --- scripts/leaking_addresses.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl index 2977371b29563..de5196c08943a 100755 --- a/scripts/leaking_addresses.pl +++ b/scripts/leaking_addresses.pl @@ -262,8 +262,9 @@ sub parse_file open my $fh, "<", $file or return; while ( <$fh> ) { + chomp; if (may_leak_address($_)) { - print $file . ': ' . $_; + printf("$file: $_\n"); } } close $fh; -- 2.33.0