Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1704794ybh; Tue, 14 Jul 2020 05:18:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqQGkrTdP3eGxUcdf61/FVOQ/tQFsqRBwDFV4KTC0gOlMcvBcqV1ZFXzxchswn4q00HWz+ X-Received: by 2002:a17:906:1f94:: with SMTP id t20mr4090756ejr.233.1594729093325; Tue, 14 Jul 2020 05:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594729093; cv=none; d=google.com; s=arc-20160816; b=DuAZWKuiCNsjgmH0mqzZopvTNkNzeMfYMxa5jMKKxUzEHfuX21vp3IizmZpcLb363Z LLSg17w951DnokeKISy+wzXZnyawPUUSoWZNwemVu0Crg8XRxBTZ6iC1RNuadprKBK/E Wf8KynjhOCJbgEPwHP/c4U0Oa05CZEM0rrxYq94d6H8HNfWFOnyEAEtv5zOOQIryRChs lAh3rBw3LC9KzbY9w6ktaahZLXiKyuZPDdDbOdobVZ9aXHezwg0Ktzt+t46MPuxwOIlY iE6cV3F9spKpMy0wUkRi11TwEDOOyNbT3YANx86tb/HQWQ3IMeex9/QuEr111pok2nFb nznQ== 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; bh=n6phaQIdwqKEEUi5eNVpa/d/Op0Av0e11pmOeheaVRA=; b=BeYvyLYcr9aCL6hd18W2X3ZlzE955JjJDn89EiogzFx00l1fmjhPLsNB1rQ1LEE3bR 1gWk/i71D6ojzVfDNL1F2vu7sqz79AyNMrt38jyNzgIUv2jTykv95lGFmmWI0dY5G4SK 7+8gUSNOBizEr2WFvik0pVv7ExrTLgChaR5e6dbWh4wrYnMqdDlqOAVS9qDuO7GPDqkK UrR+O9o5VCDxzP0bTlMfLis4J/4QY3CNwDYVSsca7V/oQJE3cmBrxWLmh+8t+F0Queve dJhnKLQ0OfOQ410AoVJmw+pWpeC66ETccderNMioci31ZJ5SJ4uDGR9pc/xg0O/bQ9oB xghA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si11240543ejx.722.2020.07.14.05.17.48; Tue, 14 Jul 2020 05:18:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728982AbgGNMQa (ORCPT + 99 others); Tue, 14 Jul 2020 08:16:30 -0400 Received: from 8bytes.org ([81.169.241.247]:52918 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728248AbgGNMKp (ORCPT ); Tue, 14 Jul 2020 08:10:45 -0400 Received: from cap.home.8bytes.org (p5b006776.dip0.t-ipconnect.de [91.0.103.118]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id B74997DD; Tue, 14 Jul 2020 14:10:43 +0200 (CEST) From: Joerg Roedel To: x86@kernel.org Cc: Joerg Roedel , Joerg Roedel , hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH v4 20/75] x86/boot/compressed/64: Check return value of kernel_ident_mapping_init() Date: Tue, 14 Jul 2020 14:08:22 +0200 Message-Id: <20200714120917.11253-21-joro@8bytes.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714120917.11253-1-joro@8bytes.org> References: <20200714120917.11253-1-joro@8bytes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel The function can fail to create an identity mapping, check for that and bail out if it happens. Signed-off-by: Joerg Roedel --- arch/x86/boot/compressed/ident_map_64.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compressed/ident_map_64.c index b4f2a5f503cd..aa91bebc0fe9 100644 --- a/arch/x86/boot/compressed/ident_map_64.c +++ b/arch/x86/boot/compressed/ident_map_64.c @@ -91,6 +91,8 @@ static struct x86_mapping_info mapping_info; */ static void add_identity_map(unsigned long start, unsigned long end) { + int ret; + /* Align boundary to 2M. */ start = round_down(start, PMD_SIZE); end = round_up(end, PMD_SIZE); @@ -98,8 +100,9 @@ static void add_identity_map(unsigned long start, unsigned long end) return; /* Build the mapping. */ - kernel_ident_mapping_init(&mapping_info, (pgd_t *)top_level_pgt, - start, end); + ret = kernel_ident_mapping_init(&mapping_info, (pgd_t *)top_level_pgt, start, end); + if (ret) + error("Error: kernel_ident_mapping_init() failed\n"); } /* Locates and clears a region for a new top level page table. */ -- 2.27.0