From patchwork Fri Apr 1 06:07:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1612060 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=NSlxy36M; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KV8pv4lH4z9sV6 for ; Fri, 1 Apr 2022 17:07:50 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1naARn-0000Bp-Gf; Fri, 01 Apr 2022 06:07:47 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1naARm-0000Bg-DY for fwts-devel@lists.ubuntu.com; Fri, 01 Apr 2022 06:07:46 +0000 Received: from canonical.com (unknown [106.104.73.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 58D7B3F1AC for ; Fri, 1 Apr 2022 06:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1648793266; bh=KpzhNmQsT0nqodQj1qQhHUcgHnl2cIujUQm3D8s0T9U=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=NSlxy36MJ0knRuYYSWCdk47vSTWHefwVuqJmI8VeTJKpGQbpEL7dVIyydlNRtNgd6 3Yvpa59SOoYOBcXL7CdikMXAcr5KuiEneTPFZSDLiycHH2Enhza1UJH4+pU6yHryYY /qs2sCB6OA3hKHKtIdodNi1TEvSoJKCVjYgxxKHW+DkvXcVGJCph+f0rs5kFI18tAR Ri+ujPcJASuRUPe+3pJ47ZtIR+zSZ+/OECOEEzfBNqbrNRDD9mcRdrD5n+OufqSjVP GIH/kEmY+6NXpr6TgjqsnKMvER4M01FaPujrOy4ew86sA+g8fNELcYvpocJ/1qJaXu uWJTJBEKC5h9g== From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi: iort: update IORT node revision check Date: Fri, 1 Apr 2022 14:07:28 +0800 Message-Id: <20220401060728.6222-1-ivan.hu@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" BugLink: https://bugs.launchpad.net/fwts/+bug/1963841 Signed-off-by: Ivan Hu Reviewed-by: Sunny Wang Signed-off-by: Ivan Hu --- src/acpi/iort/iort.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/acpi/iort/iort.c b/src/acpi/iort/iort.c index f2a8a062..dfd9c074 100644 --- a/src/acpi/iort/iort.c +++ b/src/acpi/iort/iort.c @@ -60,7 +60,35 @@ static void iort_node_check( { fwts_acpi_table_iort_node *node = (fwts_acpi_table_iort_node *)data; - if (node->type == 1 || node->type == 3 || node->type == 4) { + if (node->type == 1 || node->type == 2 || node->type == 4) { + if (node->revision > 4) { + *passed = false; + fwts_failed(fw, LOG_LEVEL_LOW, + "IORTNodeRevisionInvalid", + "IORT Node Revision field is 0x%2.2" PRIx8 + " and should be less than 5.", + node->revision); + } + } else if (node->type == 3 || node->type == 6) { + if (node->revision > 3) { + *passed = false; + fwts_failed(fw, LOG_LEVEL_LOW, + "IORTNodeRevisionInvalid", + "IORT Node Revision field is 0x%2.2" PRIx8 + " and should be less than 4.", + node->revision); + } + } else if (node->type == 5) { + if (node->revision > 2) { + *passed = false; + fwts_failed(fw, LOG_LEVEL_LOW, + "IORTNodeRevisionInvalid", + "IORT Node Revision field is 0x%2.2" PRIx8 + " and should be less than 3.", + node->revision); + } + } else { + /* type 0 */ if (node->revision > 1) { *passed = false; fwts_failed(fw, LOG_LEVEL_LOW, @@ -69,9 +97,7 @@ static void iort_node_check( " and should be zero or one.", node->revision); } - - } else - fwts_acpi_fixed_value(fw, LOG_LEVEL_MEDIUM, "IORT", "IORT Node Revision", node->revision, 0, passed); + } fwts_acpi_reserved_zero("IORT", "Node Reserved", node->reserved, passed);