From patchwork Fri Feb 7 13:25:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11370443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C99DF14E3 for ; Fri, 7 Feb 2020 13:26:39 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B006521775 for ; Fri, 7 Feb 2020 13:26:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B006521775 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j03d9-0004SA-V3; Fri, 07 Feb 2020 13:25:11 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j03d9-0004S5-9V for xen-devel@lists.xenproject.org; Fri, 07 Feb 2020 13:25:11 +0000 X-Inumbo-ID: 435c3b24-49ad-11ea-b2cb-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 435c3b24-49ad-11ea-b2cb-bc764e2007e4; Fri, 07 Feb 2020 13:25:10 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0EBC5AAC6; Fri, 7 Feb 2020 13:25:09 +0000 (UTC) To: "xen-devel@lists.xenproject.org" , Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= From: Jan Beulich Message-ID: <3deb0df2-5389-9567-3534-23e2ba57c68e@suse.com> Date: Fri, 7 Feb 2020 14:25:17 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 Content-Language: en-US Subject: [Xen-devel] [PATCH] x86/MCFG: fix off-by-one in E820 check X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Also adjust the comment ahead of e820_all_mapped() to clarify that the range is not inclusive at its end. Reported-by: Roger Pau Monné Signed-off-by: Jan Beulich Reviewed-by: Wei Liu Reviewed-by: Roger Pau Monné --- a/xen/arch/x86/e820.c +++ b/xen/arch/x86/e820.c @@ -38,7 +38,7 @@ struct e820map e820; struct e820map __initdata e820_raw; /* - * This function checks if the entire range is mapped with type. + * This function checks if the entire range [start,end) is mapped with type. * * Note: this function only works correct if the e820 table is sorted and * not-overlapping, which is the case --- a/xen/arch/x86/x86_64/mmconfig-shared.c +++ b/xen/arch/x86/x86_64/mmconfig-shared.c @@ -337,7 +337,7 @@ static int __init is_mmconf_reserved( u64 old_size = size; int valid = 0; - while (!e820_all_mapped(addr, addr + size - 1, E820_RESERVED)) { + while (!e820_all_mapped(addr, addr + size, E820_RESERVED)) { size >>= 1; if (size < (16UL<<20)) break;