Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp666113ybg; Tue, 28 Jul 2020 15:58:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWnj2MKuzihByD4P1Rm1nUIMFjlckq3YzvHk6OGO1XtFh1h9rX5iudO+NW5OeXXHBukft+ X-Received: by 2002:a05:6402:16d0:: with SMTP id r16mr13606297edx.124.1595977092262; Tue, 28 Jul 2020 15:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595977092; cv=none; d=google.com; s=arc-20160816; b=yItaUCOHebOFmpdoa0CkLu1wVSy6ghJxuIrybLb/Qa7wapsRDoDV204l5CcRnx3yhW N6Rp5T1nnx+WcZh9FRu3BfSrgmwc0VG02dThNjJ4Q40F8/3sWpSx/+khBorR6okN2zYj L2pCs/W6YD5aNpAWRAlRchWqKGdoH4Jttqjd9iMn6qgZigQo+XEjJ8sbFh/75YGGLEzy 2VNiCWL69cP3Ls7i2eo9p8lYoHMDygP1uZNhPStNIjNd3m3m78fB/n4CavsVowOxTDzW VKBHlYfod9L48a/8fiTW9Y4ilWtydZEEDdL6kmS6IhBnmKn8cSUkxlWJ/ZzrJP+ELTwq jlNA== 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=OMnubwGWNkxOlXGZw761HD6boF9d3RNrqDqbu6PUc7U=; b=UNLrogaZjzpYk7NSQipA4QPViyhrZ5X2bAbs+MDDqLm2CmQlZ3QOuMupLOcuhKD2Jf L6sC1X2gfTG22RWgERYJYJwbmeJ7hFaOGG2GSfB7Adlqd6Fjl/Z5KEA5XZvH7zqhxZ8U ootGtq58rhT/ixZ8foI3lOA64GBRNrDDLjeRq1HdRo5g6v09OXPVyrJQuv03AvzZySyf ehJR4cDMf959fjrtTozDUwlamlJ5DMWLZgqydNdzt5XbY6q9rLdGlCrp0rF2rAxuwpGf z2drVbKjtjoSSmXGbhXM8EuzpEgYzUEvBYBAYrg9Ot++luAqpHYWN10OB+JMaitZ+MdI 5zPQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si111467edj.504.2020.07.28.15.57.50; Tue, 28 Jul 2020 15:58:12 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729886AbgG1W5h (ORCPT + 99 others); Tue, 28 Jul 2020 18:57:37 -0400 Received: from mail-qv1-f67.google.com ([209.85.219.67]:45201 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729855AbgG1W53 (ORCPT ); Tue, 28 Jul 2020 18:57:29 -0400 Received: by mail-qv1-f67.google.com with SMTP id u8so9949749qvj.12 for ; Tue, 28 Jul 2020 15:57:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OMnubwGWNkxOlXGZw761HD6boF9d3RNrqDqbu6PUc7U=; b=gvk8X077k+xdgwDv3ES1pckyBCx1vT+eOlOhArwtGk5i7QIo52tBnKCUaYd47b1sMV hP82HPKEvwDJgc+8Yr4sL8bTcZ16xc8F7V0Y7n9T+OLN9noMI2OIxa8pj/y4gEtfgxb6 wISgNWidmlVr0c9N6t2Dnt2oKp2f983zz8RIBqG1DkRVFqE/MyAOImNvuUwJPjaWuxzP 1S8hM+Iz3HNhRTKnzqXCuBCF4zoKSoNPvvyw3t48UxrdEvdZin7FBke+wZN0krrycSXs +G8wkWitt3q4gZZBal8/HIBGTi9YZuMrOXwGXhjOLP6Qhc3Y9b2WNaML7E0+VkEdl2dl GajA== X-Gm-Message-State: AOAM533Kw52o3jb8JPJBh2stsZ77VVlqzSeC45PLFv8UPiFFVS3saNZr UBkxd6xAgKpeNk24kSyhWolcmhtV X-Received: by 2002:ad4:42ad:: with SMTP id e13mr30316677qvr.89.1595977048325; Tue, 28 Jul 2020 15:57:28 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id o187sm88118qkd.112.2020.07.28.15.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 15:57:27 -0700 (PDT) From: Arvind Sankar To: Kees Cook , x86@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v3 06/21] x86/kaslr: Drop redundant cur_entry from __process_mem_region Date: Tue, 28 Jul 2020 18:57:07 -0400 Message-Id: <20200728225722.67457-7-nivedita@alum.mit.edu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200727230801.3468620-1-nivedita@alum.mit.edu> References: <20200727230801.3468620-1-nivedita@alum.mit.edu> 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 cur_entry is only used as cur_entry.start + cur_entry.size, which is always equal to end. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/kaslr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 848346fc0dbb..f2454eef5790 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -624,7 +624,6 @@ static void __process_mem_region(struct mem_vector *entry, { struct mem_vector region, overlap; unsigned long start_orig, end; - struct mem_vector cur_entry; /* Ignore entries entirely below our minimum. */ if (entry->start + entry->size < minimum) @@ -634,11 +633,9 @@ static void __process_mem_region(struct mem_vector *entry, end = min(entry->size + entry->start, mem_limit); if (entry->start >= end) return; - cur_entry.start = entry->start; - cur_entry.size = end - entry->start; - region.start = cur_entry.start; - region.size = cur_entry.size; + region.start = entry->start; + region.size = end - entry->start; /* Give up if slot area array is full. */ while (slot_area_index < MAX_SLOT_AREA) { @@ -652,7 +649,7 @@ static void __process_mem_region(struct mem_vector *entry, region.start = ALIGN(region.start, CONFIG_PHYSICAL_ALIGN); /* Did we raise the address above the passed in memory entry? */ - if (region.start > cur_entry.start + cur_entry.size) + if (region.start > end) return; /* Reduce size by any delta from the original address. */ -- 2.26.2