Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1800261pxa; Thu, 6 Aug 2020 16:43:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLP1/3pcKnEZatP1KhFw0t0umJK2+ulvjH2rbli9cJiQ+7uXWB8DR1BgbAf8O1H+iU7MvV X-Received: by 2002:a50:99cf:: with SMTP id n15mr6168812edb.352.1596757407467; Thu, 06 Aug 2020 16:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596757407; cv=none; d=google.com; s=arc-20160816; b=eeEQRAU9Yf6hBdBrf9hoc/y30NnIA2Bx5w6QUWXaAPUzBiOZ1vtBcSwzKz6Ee7Mce8 RFFssMnzdK/9CCA8MHbahdSp1vZ2VqWIbaOaK4OeF5G6rgyON56ZQ4LHMAEGlluZekEL Pt0A3g4uI73KsF0vvsUjo+zkwsWNpKvcRevbzD2vZMbpLVdYWIXgcYe1g3poMHGhJSXX 5CZ/A0lx8xWK6ef8KDqXGfSrmPZo99LPqR9MStuEmWiVO3qQJWRwuC63zsiOA8SXlHbi EpqKeNM9VJFRQBlr3wvMpU6hhg15f+R9WFCeeMjvEtp0uk5SxTuQ5FkiZM09Q1v5z7EO 9QQQ== 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=UQY8wlFdAMbk+rX+h7Exb26MmUdtOhMNurOWN+bIpIg=; b=IwWYWhljkk0rYT1DkW/0wUx4Qknn3GnMkDY3dD0lubg8TF6bwjQWqkLShEeE8epx4o CVqU8IqwujsK8eRkPo2Lxqvp4kjFfnH3botEb8cMTnn9xvC/w+P2AGwX2Lw3XB6mtIKt EqJkZoJwOaGh3lj0ROVDC0Th3G9fXo95vCl3ZePPDnFX7G5RI4eG3ARwuNAuTgkKSNuJ KkgKha2fDpmAZoqINVx+q6meK8dod2m+ACIEw6TmxK0gDfK5E3o1jo4v8bIwnCa9IYHt SA2a6kxSr8c8ro6ExoERWcAbMlv82zzuc771giGMteigDnYd8L4pjBcXgDxuyp1rqgD4 qQZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=uSmfHO9J; dkim=neutral (no key) header.i=@vger.kernel.org; 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 v5si5291654edi.437.2020.08.06.16.43.04; Thu, 06 Aug 2020 16:43:27 -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=uSmfHO9J; dkim=neutral (no key) header.i=@vger.kernel.org; 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 S1726821AbgHFXkA (ORCPT + 99 others); Thu, 6 Aug 2020 19:40:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbgHFXi4 (ORCPT ); Thu, 6 Aug 2020 19:38:56 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 755ECC061574; Thu, 6 Aug 2020 16:38:56 -0700 (PDT) Date: Thu, 06 Aug 2020 23:38:54 -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=UQY8wlFdAMbk+rX+h7Exb26MmUdtOhMNurOWN+bIpIg=; b=uSmfHO9JSwFXv5DkbxOyGi01CvK+Qd8dY2rXU9xpGMSmtom/svXcoRKrMrSelbtVEGdKyW lhUoJn3HdVBj4jXxlRFFZSb7UWQoEwDSamggwQNux1ziUrS/ktRb/jJ7OFe2R2MiZ2Tj7L u1ukXOMPj8JD+dfWG+KHTEzsZyxXEwZ0jYULM6uAIth40G53FK29B3WCafhAF+kxO58maA rbQtlgaF+hyt5YAW0E+1CoKmFa8op7ddtRxWQ/3HOWpz5Ck6ka89N8DHU2bIy8zjofaYCN fPETWonadXgHMw2Wbom6hY4OcBgz3GVC9Jn/Cn9gUS3eqOftu1blJTub2Q0GYw== 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=UQY8wlFdAMbk+rX+h7Exb26MmUdtOhMNurOWN+bIpIg=; b=GcjmlV6odMwkI2p3AEn4e7hky5ksrHxqcaXaGzUwbZNfCUwK10ce7R63qubs/eKciNfyt3 PBTP1pUmoF1bIXBQ== 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: Drop redundant check in store_slot_info() Cc: Arvind Sankar , Ingo Molnar , x86 , LKML In-Reply-To: <20200728225722.67457-16-nivedita@alum.mit.edu> References: <20200728225722.67457-16-nivedita@alum.mit.edu> MIME-Version: 1.0 Message-ID: <159675713441.3192.1630860700272865045.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: 46a5b29a4a63a3ba987cbb5467774a4b5787618e Gitweb: https://git.kernel.org/tip/46a5b29a4a63a3ba987cbb5467774a4b5787618e Author: Arvind Sankar AuthorDate: Tue, 28 Jul 2020 18:57:16 -04:00 Committer: Ingo Molnar CommitterDate: Fri, 31 Jul 2020 11:08:17 +02:00 x86/kaslr: Drop redundant check in store_slot_info() Drop unnecessary check that number of slots is not zero in store_slot_info, it's guaranteed to be at least 1 by the calculation. Signed-off-by: Arvind Sankar Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20200728225722.67457-16-nivedita@alum.mit.edu --- 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 5c7457c..0c64026 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -525,13 +525,10 @@ static void store_slot_info(struct mem_vector *region, unsigned long image_size) return; slot_area.addr = region->start; - slot_area.num = (region->size - image_size) / - CONFIG_PHYSICAL_ALIGN + 1; + slot_area.num = 1 + (region->size - image_size) / CONFIG_PHYSICAL_ALIGN; - if (slot_area.num > 0) { - slot_areas[slot_area_index++] = slot_area; - slot_max += slot_area.num; - } + slot_areas[slot_area_index++] = slot_area; + slot_max += slot_area.num; } /*