Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1798789pxa; Thu, 6 Aug 2020 16:40:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkA+eBdyaQPfbJ/S/ual6ol3r91jOpJFxok0SHNouZqa9Mgpp6TRlQufpdE8md9hE99W2q X-Received: by 2002:a17:906:1105:: with SMTP id h5mr6659038eja.307.1596757235467; Thu, 06 Aug 2020 16:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596757235; cv=none; d=google.com; s=arc-20160816; b=PolS0H7KNtz4aWbWzGYIyV6Z26UWlNVZufR9RFyxpckAl2OA/a9P/c294SCJAz+OOU v98GVNEXQv3I0BzvJ24Ui8THsly1RFsdgSkWdUx53DEBGfOLrhT0Yqbsh2mliQufRguo uHmYQA+4Syna8b09ymCukrZtmJRnx7p0MtwGTC2JyWJK4vG/XmOaLu7BVFsNI7rNNy6c Hb8L1BHKuZ+9vW7D++7td2JeBnHLzxo1WUizLZ45LSuDQUY4/C4sNokN2bxw4Ck6pXOY IRAyqCIJFLygHHHkfbi7NnIppXwPceCUQKdLNVRGk5YYKVxu+lD+v7zWUrXG2LGmjg2V 4E3A== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=UJ3t4IzCnqYZfoqTW+ZNYage2ClJbjW6jNQ/cNP+1gg=; b=rbKPLm5psifsyxRT/p/ckFfjZAj+AVqyJJaHsOK0Y5m7ekIxSQGNboBbkPCycEr7AN wvlo1Ws4DwyFrJwgW+C4OQYNUOElQ3RafS4D3mV8WjwZHlpjzJ2VHZAsWMvCt473CfU7 5f+olfM7SteqR7p3iu5Y6PF/l3RWcK1qLjVf5/mQuMlaIqnOVNQQ6jsrUL/UwAfPTU0z PjdcdFR5DAFt6LUfdVMYGTJvPerhjbYirCBYykbFU52kpTbT3i96hPFYanccpvs1osxp xwGpCUb9fAFjBGkPaIwSVMqOqqqgF9760p9irsHVgYzg96x0IPKBEcvnjX80qOUyS4PI Cwug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=oE3qlRgB; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=KUnK+3i2; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c20si3979270edx.70.2020.08.06.16.40.12; Thu, 06 Aug 2020 16:40:35 -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; dkim=fail header.i=@linutronix.de header.s=2020 header.b=oE3qlRgB; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=KUnK+3i2; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726787AbgHFXjH (ORCPT + 99 others); Thu, 6 Aug 2020 19:39:07 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:60966 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726394AbgHFXi6 (ORCPT ); Thu, 6 Aug 2020 19:38:58 -0400 Date: Thu, 06 Aug 2020 23:38:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1596757135; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UJ3t4IzCnqYZfoqTW+ZNYage2ClJbjW6jNQ/cNP+1gg=; b=oE3qlRgBgzCoamBeEMYL1355nUULygJBiEh+kih8MG1Vqy0NqMx2w4bzF6+J3AfAqcUh// VOPsfTN0gIZ1ge1BEfdKyCgeiijOP7d9Je8TzWq/p6j05rxkBQSM7cDv2PetYgxGPDBpNX ZsQUb73UZ8bJlf4alr7WiDbjAZcv63w2s4plFYrYPWs/p3TNQz+Q5vtH1b6SsqyT/Styu3 3wTOpp+HMcl+R1gC52LiDGDZ5sZRNCGi9qGok09HEEuBZ67iSsjpRg2buMwP4qujEPl7T4 3xAaPBhROIfucRC8e8+RnmV5mjNX5Q+0gXNXxB7TLAjojzX/JMKMaDmQaZQPYg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1596757135; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UJ3t4IzCnqYZfoqTW+ZNYage2ClJbjW6jNQ/cNP+1gg=; b=KUnK+3i2wgEdtL6jzWf+2qZBLv9641WPlsvTULJUbV+98qhrQbebwl4YqgdE7ZptYMKKnl wSk1U/JKcgcC51Bw== From: "tip-bot2 for Arvind Sankar" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/kaslr] x86/kaslr: Make the type of number of slots/slot areas consistent Cc: Arvind Sankar , Ingo Molnar , x86 , LKML In-Reply-To: <20200728225722.67457-15-nivedita@alum.mit.edu> References: <20200728225722.67457-15-nivedita@alum.mit.edu> MIME-Version: 1.0 Message-ID: <159675713511.3192.15949852694615792267.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/kaslr branch of tip: Commit-ID: d6d0f36c735367ed7cf42b5ba454ba5858e17816 Gitweb: https://git.kernel.org/tip/d6d0f36c735367ed7cf42b5ba454ba5858e17816 Author: Arvind Sankar AuthorDate: Tue, 28 Jul 2020 18:57:15 -04:00 Committer: Ingo Molnar CommitterDate: Fri, 31 Jul 2020 11:08:17 +02:00 x86/kaslr: Make the type of number of slots/slot areas consistent The number of slots can be 'unsigned int', since on 64-bit, the maximum amount of memory is 2^52, the minimum alignment is 2^21, so the slot number cannot be greater than 2^31. But in case future processors have more than 52 physical address bits, make it 'unsigned long'. The slot areas are limited by MAX_SLOT_AREA, currently 100. It is indexed by an int, but the number of areas is stored as 'unsigned long'. Change both to 'unsigned int' for consistency. Signed-off-by: Arvind Sankar Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20200728225722.67457-15-nivedita@alum.mit.edu --- arch/x86/boot/compressed/kaslr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index bd13dc5..5c7457c 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -508,17 +508,15 @@ static bool mem_avoid_overlap(struct mem_vector *img, struct slot_area { unsigned long addr; - int num; + unsigned long num; }; #define MAX_SLOT_AREA 100 static struct slot_area slot_areas[MAX_SLOT_AREA]; - +static unsigned int slot_area_index; static unsigned long slot_max; -static unsigned long slot_area_index; - static void store_slot_info(struct mem_vector *region, unsigned long image_size) { struct slot_area slot_area; @@ -588,7 +586,7 @@ process_gb_huge_pages(struct mem_vector *region, unsigned long image_size) static unsigned long slots_fetch_random(void) { unsigned long slot; - int i; + unsigned int i; /* Handle case of no slots stored. */ if (slot_max == 0)