Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp666415ybg; Tue, 28 Jul 2020 15:58:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvxpKoMLg/2t7FscM2JGfqOV9oqnyHDm2lcWg9Q2hllTuEVFx87ETlckML5PFW7nDAe2bd X-Received: by 2002:aa7:d6c7:: with SMTP id x7mr13362215edr.167.1595977136518; Tue, 28 Jul 2020 15:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595977136; cv=none; d=google.com; s=arc-20160816; b=jjRwU36UwN2fWfOUP7asMkP9BJwb7mppwmBhzWdAyHA6FfnxjFcf3VnFfKQUFjnyIv jVezU4ejbRAt1Peu2OGgUG++OXAeI5WiQBEWWDLnqNvDrry3Miwm/7ynFkfpMa7Towx9 7VOgxwNAVskk6yT5vLQ5MqF/CZGtHrCHgDkHQI0wqp+1c/no497tav/T26p6JETTwFQH ql8Gyy4G6ZlejQOdTYxOCFfq9taqUt0FkS9L3o24E52dtZ6euhZxJbGOYAgvEG5IC8W8 8n96GYOy/ACeXFphQd2PYRjtPmLnGW9O1w7p9yMTB4D+ECzNXchWW5KAlJCdmmjVtzUe 0qFA== 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=yXGK2iD82DmJ1lw/0Vk2HVFHezNuEb65G8E7AUhsQGs=; b=DG5NCJIjur4BWyXPaextjqlMkaodxZ9aZfQ79XeAIHUyl0TKaB4b/zqM9nM3HCQkDz NDSfGVGV1DpzZqLgMzCDRvhCjPaBy2TjogRu+NVGxdOpkawLQsEGyrmM1WK47627MmWF P4wWIFrQcQl9+T1x96Q5VmWNPN5oRrDK8DfuoDePPZCPPVO6xzbfwCpl8fW8+M7DMNa2 /LxBL2uz2CixyPUgdcRZa/z6uKdSgggVlneGbYuT7MOCU57HTi5CUUc/0kMUkHEmV5pP LG6v31f0z6wGGHzv5KmXoI78no23bLWt2exWV00GsF2Zaupt2sdYS/8e8Xvhx3YzZ4yW BnkQ== 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 g22si122801edm.294.2020.07.28.15.58.34; Tue, 28 Jul 2020 15:58:56 -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 S1730220AbgG1W56 (ORCPT + 99 others); Tue, 28 Jul 2020 18:57:58 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:45968 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730037AbgG1W5i (ORCPT ); Tue, 28 Jul 2020 18:57:38 -0400 Received: by mail-qk1-f195.google.com with SMTP id u64so20414547qka.12 for ; Tue, 28 Jul 2020 15:57:37 -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=yXGK2iD82DmJ1lw/0Vk2HVFHezNuEb65G8E7AUhsQGs=; b=p9yFoIo6cNSE+2j+sTSmgxUpFhPd5Fsk7bwwRSSpQALanSBppfyPMeZI6gzOqA2Px5 1XIg08mAAxPp74A7pDmSBhgLHs03pRpAw4F6FF9FwY+bg2wqdLW1gN8nd8arqjkkvDXq MQcGlXs+dEYbQ+qzoLOi5KGemDYKLR+2GBSnKyU7+U1MCrcYtmiOGU+afIlrcJAYS+BP 5ugM/l8ET+6jMynGKLHTsh7mcfuslo4CNnqg8Un6VZ5NOKmMhvNz9Ng5KniIcM8S5pSp kKN9cu9AqZBj/zCRfL9xklhDk2brme1WMJmKhy6cGHA/1pXx6Mrx1VQ85lQsfBWl0Fzp A6pA== X-Gm-Message-State: AOAM533fjpcea9Uz8+bXDx3nUhrU7pEhqYaExUIim686PhJGl0E9urFh D7NoD1H6BrJWOaw1/f2SihQ= X-Received: by 2002:a37:47d5:: with SMTP id u204mr27233714qka.487.1595977057404; Tue, 28 Jul 2020 15:57:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 15:57:36 -0700 (PDT) From: Arvind Sankar To: Kees Cook , x86@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v3 17/21] x86/kaslr: Small cleanup of find_random_phys_addr Date: Tue, 28 Jul 2020 18:57:18 -0400 Message-Id: <20200728225722.67457-18-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 Just a trivial rearrangement to do all the processing together, and only have one call to slots_fetch_random in the source. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/kaslr.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 4fd60eff048f..0e103d4d452e 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -812,10 +812,9 @@ static unsigned long find_random_phys_addr(unsigned long minimum, return 0; } - if (process_efi_entries(minimum, image_size)) - return slots_fetch_random(); + if (!process_efi_entries(minimum, image_size)) + process_e820_entries(minimum, image_size); - process_e820_entries(minimum, image_size); return slots_fetch_random(); } -- 2.26.2