From patchwork Mon Sep 25 07:44:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1051432vqu; Mon, 25 Sep 2023 01:13:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWlXbi5jUtzZDs3rX2CEOqsEKPEnAPA6GhCW82FUDqQowmW+veoRipqfqMkM9kiQOZjsqb X-Received: by 2002:a17:902:dac1:b0:1c6:1d3d:b412 with SMTP id q1-20020a170902dac100b001c61d3db412mr1207804plx.30.1695629584648; Mon, 25 Sep 2023 01:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695629584; cv=none; d=google.com; s=arc-20160816; b=XSk1B2JM8D3hGppdMPjJJL6ZoYngxxrTxePknQ1d6h0sOihnmG9AyOXEHELjdXx3xc sWaQq3zT6Q0nMx2NmG1xGLJgoqioBtEOu7bErwO+9QE1qqeW3A7iD22Yp32JYj56BmOx 3oNNKa4sFj4fhJyJNnj11lJvGhYDNKNx93708N/wrRNtaRZi4pLSQBPRykiAL294poHH nP44Lk1cnzRiuefHmqk+9b9n4QbPfkkrGeGyoOyCO5UnOZM4t6JEi2L7sPb3BAA6EZm2 4RDUHTuSL39SrZLGudV61iv7Xs+DTumEkfpad+E0fOYuleCqKJFQPGiIJiylSwntP8gS fBww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=a0ykU0DCtEpSTz+Rb1yKUiw+DgcibIyW0sHVZoEC2JI=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=RKZWeQKb1ehD3jfnKSDr35LkVzJy3BzQcOSUYlNM5v89+yWckjq9Y+/Xo5uJDfpCGV PSvbg8I7SYTl1xeXCbT/OeVzAqC5wHHoBl9Cg+lBWrgPscBxBUc+OKLeYPGbtNNW4udO 3ECTkST+FFuqf4Po09VCBMuUn9Upv6zZv6GoqLz04zJxHG2Y3/eFrMxpEeLUzSq2iWZT VnIEVfrrghRsKMwlVaFy60R0UZRB7cZ6Zfww1FNm4uhax/g/O2x/MP5gk/oxKha8AwNq S8T42vLtcL0uW019CF1QF77ozf7VjWdNIPzabsuu+olZOQFz98OqVZg4zlbGTg8XlkTr /INA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s17-20020a170902c65100b001b3d27ca12fsi8782252pls.207.2023.09.25.01.13.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:13:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A43798283A47; Mon, 25 Sep 2023 00:45:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232474AbjIYHo6 (ORCPT + 30 others); Mon, 25 Sep 2023 03:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232462AbjIYHou (ORCPT ); Mon, 25 Sep 2023 03:44:50 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E97B9EE; Mon, 25 Sep 2023 00:44:42 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvt.C_1695627878; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvt.C_1695627878) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:39 +0800 From: Shuai Xue To: keescook@chromium.org, tony.luck@intel.com, gpiccoli@igalia.com, rafael@kernel.org, lenb@kernel.org, james.morse@arm.com, bp@alien8.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ardb@kernel.org, robert.moore@intel.com Cc: linux-hardening@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-efi@vger.kernel.org, acpica-devel@lists.linuxfoundation.org, xueshuai@linux.alibaba.com, baolin.wang@linux.alibaba.com Subject: [RFC PATCH v2 4/9] ACPI: tables: change section_type of generic error data as guid_t Date: Mon, 25 Sep 2023 15:44:21 +0800 Message-Id: <20230925074426.97856-5-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230925074426.97856-1-xueshuai@linux.alibaba.com> References: <20230925074426.97856-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:45:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777996487318119875 X-GMAIL-MSGID: 1777996487318119875 The section_type of generic error data is now an array of u8. It is a burden to perform explicit type casting from u8[] to guid_t, and to copy the guid_t values to u8[] using memcpy. To alleviate this issue, change the section_type from an array to the type guid_t, which is also consistent with the cper_section_descriptor. Signed-off-by: Shuai Xue --- drivers/acpi/acpi_extlog.c | 2 +- drivers/acpi/apei/ghes.c | 2 +- drivers/firmware/efi/cper.c | 2 +- include/acpi/actbl1.h | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c index e120a96e1eae..d46435792d64 100644 --- a/drivers/acpi/acpi_extlog.c +++ b/drivers/acpi/acpi_extlog.c @@ -170,7 +170,7 @@ static int extlog_print(struct notifier_block *nb, unsigned long val, fru_text = gdata->fru_text; else fru_text = ""; - sec_type = (guid_t *)gdata->section_type; + sec_type = &gdata->section_type; if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) { struct cper_sec_mem_err *mem = acpi_hest_get_payload(gdata); diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index ef59d6ea16da..d14e00751161 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -648,7 +648,7 @@ static bool ghes_do_proc(struct ghes *ghes, sev = ghes_severity(estatus->error_severity); apei_estatus_for_each_section(estatus, gdata) { - sec_type = (guid_t *)gdata->section_type; + sec_type = &gdata->section_type; sec_sev = ghes_severity(gdata->error_severity); if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID) fru_id = (guid_t *)gdata->fru_id; diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index 35c37f667781..a2ba70aa928f 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -527,7 +527,7 @@ static void cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata, int sec_no) { - guid_t *sec_type = (guid_t *)gdata->section_type; + guid_t *sec_type = &gdata->section_type; __u16 severity; char newpfx[64]; diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 8d5572ad48cb..ab25a8495a43 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -19,6 +19,7 @@ * ******************************************************************************/ +#include /* * Values for description table header signatures for tables defined in this * file. Useful because they make it more difficult to inadvertently type in @@ -1637,7 +1638,7 @@ struct acpi_hest_generic_status { /* Generic Error Data entry */ struct acpi_hest_generic_data { - u8 section_type[16]; + guid_t section_type; u32 error_severity; u16 revision; u8 validation_bits; @@ -1650,7 +1651,7 @@ struct acpi_hest_generic_data { /* Extension for revision 0x0300 */ struct acpi_hest_generic_data_v300 { - u8 section_type[16]; + guid_t section_type; u32 error_severity; u16 revision; u8 validation_bits;