Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2431267imu; Sun, 13 Jan 2019 01:51:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN51ZweHl0gLezzdLvWHyorzm0ygUfvcJ1NJ0QbuIJSt0E4HVRH7tJsdTmVTlwXCHSZib84m X-Received: by 2002:a63:63c2:: with SMTP id x185mr15369299pgb.374.1547373096129; Sun, 13 Jan 2019 01:51:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547373096; cv=none; d=google.com; s=arc-20160816; b=P1EJ7vbWxTXusb1WGZ1Sd43UwCpzxjPQDx4XnfzjM4kb3+ogI45cZXTJDj5ysvUHGC CEV7n6khJaVU/Sx/sqCAJrYuUAfqUcpc5pdxzcRI1IHonWczwokMik413ccvl9GSfmNs iAwyzBXrnAb7xnZezzioUHgPNVRGCmw9kxIYeYueuF0P0G+M2ljryrabs4QOmUzNsb4k AGNNk9f81/hnX6ScZ3GZ/GdPWJyOI5dwUX6lDCuvxNrdLZieX2gs9xgqa4Y6BjE3Pmmt +RW/+YZSwmeyr6ZYZW+CS1FweQrhmLcsgtGWJzYJY4B9/nmOLMzGMWhtF0gQPwSBzZBY pFmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=8R4EFUPlJsj3WGZRr7Ma9lP/6g2p2cruNruPo2QhIpc=; b=WsvVS6l/7UnM/CNFyOgERl9c1WhnXfTBJf2/nPMNe250W5h/jS//6NyolmPqEYDkqT +9eGU/7YDHTXHvEJKGnjy3ZMdQJyhDHlOQ5r+1Q/Z5myKWrw/a14IP+dJikluMyhyv13 PlMQMnsSpqZ+awOC7rCC0blRUF0Jfcd46oaLWcsuHgZke3uSQ9E19InpeUMttsgGQd4o n7f1LKKa1nUX+3LfpJcW2isHgcgP/1UO9B6QeNPLlhbuylzV6JJ6iyta6wab3ze6ehXc utrfIqxkCeB6SsDDYY5p4rCXslkUfp/2dSfqy4hLIMRhJd22+bd28JKc3cQvO1msUhmn +wFA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si42735163plg.62.2019.01.13.01.51.06; Sun, 13 Jan 2019 01:51:36 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726551AbfAMJso (ORCPT + 99 others); Sun, 13 Jan 2019 04:48:44 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:57920 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725875AbfAMJso (ORCPT ); Sun, 13 Jan 2019 04:48:44 -0500 X-IronPort-AV: E=Sophos;i="5.56,473,1539619200"; d="scan'208";a="51907664" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 13 Jan 2019 17:48:01 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id E56E34B7D57E; Sun, 13 Jan 2019 17:48:00 +0800 (CST) Received: from localhost.localdomain (10.167.225.56) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 13 Jan 2019 17:48:00 +0800 Date: Sun, 13 Jan 2019 17:47:04 +0800 From: Chao Fan To: Borislav Petkov CC: , , , , , , , , , Subject: Re: [PATCH v15 3/6] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table Message-ID: <20190113094704.GC13263@localhost.localdomain> References: <20190107032243.25324-1-fanc.fnst@cn.fujitsu.com> <20190107032243.25324-4-fanc.fnst@cn.fujitsu.com> <20190110211523.GG17621@zn.tnic> <20190111012353.GD2216@localhost.localdomain> <20190111103225.GA4729@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190111103225.GA4729@zn.tnic> User-Agent: Mutt/1.10.1 (2018-07-13) X-Originating-IP: [10.167.225.56] X-yoursite-MailScanner-ID: E56E34B7D57E.AAD14 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: fanc.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 11, 2019 at 11:32:25AM +0100, Borislav Petkov wrote: >On Fri, Jan 11, 2019 at 09:23:53AM +0800, Chao Fan wrote: >> Yes, 'table64' looks superfluous here, but after these lines, there is: >> if (!IS_ENABLED(CONFIG_X86_64) && table64 >> 32) { >> so the 'table64' is useful here for i386. 'table' is unsigned long, it >> can't do the right shift. But the 'table64' who is u64 can do that right >> shift. > >Have you actually tried fixing what I suggested or you're just talking? Sure, I tried what I was talking. I ever used 'unsigned long table' directly. But that caused warning: CC arch/x86/boot/compressed/acpi.o arch/x86/boot/compressed/acpi.c: In function ‘efi_get_rsdp_addr’: arch/x86/boot/compressed/acpi.c:106:44: warning: right shift count >= width of type [-Wshift-count-overflow] if (!IS_ENABLED(CONFIG_X86_64) && table >> 32) { To avoid this warning, I add 'u64 table64' to do the right shift. Well, the acpi_physicall_address defined as: #if ACPI_MACHINE_WIDTH == 64 typedef u64 acpi_physical_address; #elif ACPI_MACHINE_WIDTH == 32 #ifdef ACPI_32BIT_PHYSICAL_ADDRESS typedef u32 acpi_physical_address; #else /* ACPI_32BIT_PHYSICAL_ADDRESS */ /* * It is reported that, after some calculations, the physical addresses can * wrap over the 32-bit boundary on 32-bit PAE environment. * https://bugzilla.kernel.org/show_bug.cgi?id=87971 */ typedef u64 acpi_physical_address; #endif 'acpi_physical_address' could be define as u64 or u32. In my guest machine, it's defined as u64, there is no problem as you suggested. I didn't find a machine where 'acpi_physical_address' defined as u32. I thought if 'acpi_physical_address' defined as u32, it will meet the same warning as using 'unsigned long'. I tried to define 'table' as u32, that will also cause the warning. So once acpi_physical_address is define as u32, that warning will happen. We should make sure u64 to do the right shift. Thanks, Chao Fan > >--- >diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c >index e9dd84f459ed..0537d46fb21f 100644 >--- a/arch/x86/boot/compressed/acpi.c >+++ b/arch/x86/boot/compressed/acpi.c >@@ -77,21 +77,19 @@ static acpi_physical_address efi_get_rsdp_addr(void) > sizeof(efi_config_table_32_t); > > for (i = 0; i < systab->nr_tables; i++) { >+ acpi_physical_address table; > void *config_tables; >- unsigned long table; > efi_guid_t guid; > > config_tables = (void *)(systab->tables + size * i); > if (efi_64) { > efi_config_table_64_t *tmp_table; >- u64 table64; > > tmp_table = config_tables; > guid = tmp_table->guid; >- table64 = tmp_table->table; >- table = table64; >+ table = tmp_table->table; > >- if (!IS_ENABLED(CONFIG_X86_64) && table64 >> 32) { >+ if (!IS_ENABLED(CONFIG_X86_64) && table >> 32) { > debug_putstr("Error getting RSDP address: EFI config table located above 4GB.\n"); > return 0; > } > >-- >Regards/Gruss, > Boris. > >Good mailing practices for 400: avoid top-posting and trim the reply. > >