From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr710133.outbound.protection.outlook.com ([40.107.71.133]:63774 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727599AbeH3WGq (ORCPT ); Thu, 30 Aug 2018 18:06:46 -0400 From: Sasha Levin To: "stable@vger.kernel.org" CC: Denis Efremov , Masahiro Yamada , Sasha Levin Subject: [PATCH AUTOSEL 4.18 054/113] coccicheck: return proper error code on fail Date: Thu, 30 Aug 2018 18:03:24 +0000 Message-ID: <20180830180050.35735-54-alexander.levin@microsoft.com> References: <20180830180050.35735-1-alexander.levin@microsoft.com> In-Reply-To: <20180830180050.35735-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Denis Efremov [ Upstream commit 512ddf7d7db056edfed3159ea7cb4e4a5eefddd4 ] If coccicheck fails, it should return an error code distinct from zero to signal about an internal problem. Current code instead of exiting with the tool's error code returns the error code of 'echo "coccicheck failed"' which is almost always equals to zero, thus failing the original intention of alerting about a problem. This patch fixes the code. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Denis Efremov Acked-by: Julia Lawall Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/coccicheck | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/coccicheck b/scripts/coccicheck index 9fedca611b7f..e04d328210ac 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -128,9 +128,10 @@ run_cmd_parmap() { fi echo $@ >>$DEBUG_FILE $@ 2>>$DEBUG_FILE - if [[ $? -ne 0 ]]; then + err=3D$? + if [[ $err -ne 0 ]]; then echo "coccicheck failed" - exit $? + exit $err fi } =20 --=20 2.17.1