From patchwork Tue Nov 27 03:12:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Rue X-Patchwork-Id: 152104 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp736727ljp; Mon, 26 Nov 2018 19:13:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/UC8k+GPVxGbtVGFIy7rbJEVXQBZgjgxjE5Vhx4DdkA1phkBKgd0XEmHAZAgJqN82A0zrLc X-Received: by 2002:a63:4d:: with SMTP id 74mr28322232pga.248.1543288379850; Mon, 26 Nov 2018 19:12:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543288379; cv=none; d=google.com; s=arc-20160816; b=GLbUUNq7WuUPnV8wnP/48IkyjMTeOwksG0orZmOIZFR+xX7Z89qSTJs7P3zCgUJrHd gc3LDs/TTRp3ayzLj8IwL7pChv5cumA5m7Uk+WB1bLC2jLTqvhPzYUnu3T2mWbykOZjU AM2G5gGrZ0dsJhiunS7QgUYX8QCG3GGktcId4rkQ4hOu8ec6R7kk/NEbVNWOsvBCBrwz w4JmB/nQE4mP6v6DL6bT64upb4ioh2y3xIC9KTiwcXMvLfYjXMUl1hVCCW5mSTtjQqOA 9v0XxJW1kXWj+151EdJSSveLavTS1ABluGxC6qGttimY9pl8KeLwyxuErvVmdjgTUsi9 EwRw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wGt0nwknXf8js5Tv9n0b8MS3AqmG0XFqvIR4lkoqZTw=; b=ww2z9ju6mrZ51MU745kTad4mzDwQqHna8N1Gur0va1+PV4lsxIK+HtFO88nPNYcfLi 6CO6+ZgX1/GU1szGZW/I3Y/MWWlIgZHFcoV8gWfW1cqz8sMrCUqoj6oeGSQIwpik1rXp IoA3hyMLWUB0My6U0CJRqdqSg/rp/tAr7WxGfrHAcbZujul6k0p8uQTi5aKK72cz3rw5 s8+3BrlwPes/T3nYVeJYfvGF76Lb6muTfRhQqscqsCtUqf4w2YnKvbMa43YTtKaxKueY AlTxDBCzoWz8v4yBG2RFmjDid2TvdZ7VQLyHJW87qUXwJcsvwpjtCOL9moUxEr9zgxLb 372w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QCWWrozD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6-v6si2412346plt.328.2018.11.26.19.12.59; Mon, 26 Nov 2018 19:12:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QCWWrozD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728510AbeK0OJV (ORCPT + 32 others); Tue, 27 Nov 2018 09:09:21 -0500 Received: from mail-io1-f50.google.com ([209.85.166.50]:46452 "EHLO mail-io1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728431AbeK0OJU (ORCPT ); Tue, 27 Nov 2018 09:09:20 -0500 Received: by mail-io1-f50.google.com with SMTP id v10so10145294ios.13 for ; Mon, 26 Nov 2018 19:12:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wGt0nwknXf8js5Tv9n0b8MS3AqmG0XFqvIR4lkoqZTw=; b=QCWWrozDLm9AGnpjiOXGa4PFMJN2Pf/cim+RMMzNvMJ6syz7bMXCxXmB1XpvnddaUo 1lqSL6yjBjp4deDVpxQ1qlTg7UY+QRMefZozjSETvA/H41P2GdddstjILPBPbkYrabJn IICVT3FKOS8AGAsa8nCYLIovyU2tcPKNOJmlw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wGt0nwknXf8js5Tv9n0b8MS3AqmG0XFqvIR4lkoqZTw=; b=AKqrTvK9EMaXJkEXtsL5SZBxCIOKSbQaesLGjvReQu+nBlyKy0Qc50v1E34jgNdsrx lUoPbYnadm0mRK8ooM7jMMUpNfIKgc16ZTJwHFVgssc4ODHHSS0ijXgMyzDyX7kth1vM T+xNQoCqIRdy4m//5t/JFw1cR5wY3hRsuoTcucHw6nO88buxQMAtoEC5XDm+ZiPL0uFX G7Gs/mQrT2Cl5+MH/NZmJzFNP4bitM5vxnIVqnxnuJgpF7U3GqKoPB+0suEmkNhX3fdM PYb5d+f/ZvPxno3yAktfjlPQoIipgqqJpNSPhGZLm71k4Ud7PRHxbSARSEalZclIzcES 5Eag== X-Gm-Message-State: AA+aEWY3T+V81ugy1HfK+yTKYbKKbyewQEWypKcCm+yGPGUZYQDC7yRu Uei+YU5tumjHePnF7cF+fEF8sCh3sKA= X-Received: by 2002:a5d:8b8d:: with SMTP id p13mr16027638iol.223.1543288376162; Mon, 26 Nov 2018 19:12:56 -0800 (PST) Received: from localhost (c-107-2-67-121.hsd1.mn.comcast.net. [107.2.67.121]) by smtp.gmail.com with ESMTPSA id w186sm1149449itb.15.2018.11.26.19.12.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Nov 2018 19:12:55 -0800 (PST) From: Dan Rue To: linux-kernel@vger.kernel.org Cc: Dan Rue , Shuah Khan , Greg Kroah-Hartman , Kees Cook , "Luis R. Rodriguez" , linux-kselftest@vger.kernel.org Subject: [PATCH 1/2] selftests: firmware: remove use of non-standard diff -Z option Date: Mon, 26 Nov 2018 21:12:15 -0600 Message-Id: <20181127031218.24419-2-dan.rue@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181127031218.24419-1-dan.rue@linaro.org> References: <20181127031218.24419-1-dan.rue@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org -- 2.19.1 Acked-by: Kees Cook diff -Z is used to trim the trailing whitespace when comparing the loaded firmware file with the source firmware file. However, per the comment in the source code, -Z should not be necessary. In testing, the input and output files are identical. Additionally, -Z is not a standard option and is not available in environments such as busybox. When -Z is not supported, diff fails with a usage error, which is suppressed, but then causes read_firmwares() to exit with a false failure message. Signed-off-by: Dan Rue --- tools/testing/selftests/firmware/fw_filesystem.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh index a4320c4b44dc..466cf2f91ba0 100755 --- a/tools/testing/selftests/firmware/fw_filesystem.sh +++ b/tools/testing/selftests/firmware/fw_filesystem.sh @@ -155,11 +155,8 @@ read_firmwares() { for i in $(seq 0 3); do config_set_read_fw_idx $i - # Verify the contents are what we expect. - # -Z required for now -- check for yourself, md5sum - # on $FW and DIR/read_firmware will yield the same. Even - # cmp agrees, so something is off. - if ! diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then + # Verify the contents match + if ! diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then echo "request #$i: firmware was not loaded" >&2 exit 1 fi @@ -171,7 +168,7 @@ read_firmwares_expect_nofile() for i in $(seq 0 3); do config_set_read_fw_idx $i # Ensures contents differ - if diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then + if diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then echo "request $i: file was not expected to match" >&2 exit 1 fi