From: Denis Efremov Date: Fri, 10 Aug 2018 20:25:55 +0000 (+0300) Subject: coccicheck: return proper error code on fail X-Git-Tag: v4.18.8~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d39ab3401ff072eee6e93d5575fcbeba63bf69a;p=thirdparty%2Fkernel%2Fstable.git coccicheck: return proper error code on fail [ 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/scripts/coccicheck b/scripts/coccicheck index 9fedca611b7f8..e04d328210ac2 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=$? + if [[ $err -ne 0 ]]; then echo "coccicheck failed" - exit $? + exit $err fi }