Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp668501ybg; Tue, 28 Jul 2020 16:02:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8VXyHom19kGH2U4Pwllh+RVI6jHTXtsQG/x0jxkQFwkS0X77mi3YLKNr9ia4BWXnQzFqv X-Received: by 2002:a17:906:7017:: with SMTP id n23mr26984386ejj.262.1595977320316; Tue, 28 Jul 2020 16:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595977320; cv=none; d=google.com; s=arc-20160816; b=b6H2lIJqkZohx6VZZOJ6LfXrA/fq1I4guh6uO9hEtYWqSPnIkkYSSNCKNHaNXLYNPQ CRfKNLXgGLP0X+SzKnVVFLZefoAIGpA+jitmqGh7KZNZiIi4jBuaEebrTiKjfAcbhIIN QL5TGQ7VSQUyAC7FvvI+DTfj0zYtBwkd070eYMEWNWKz3yVXo6txRpEgh9FVsT1Xibhx V0AwBQAXKH1uGLq36eKZ8vJCyR+lJiLyNHxa6tplBQ04mbX/M2xKqQPeEWMZhgR3mE51 Imo/M39mnllUs88WH+mrsoGTMlGGpXaRZASElq64GO4rL716mEqKYCBHiJP/4USxlNgi mS9Q== 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=EOrXDcIpu0+Rojg4/uOteaJXevmZGAY4mWywC4YjIo8=; b=Rg6Z59Dwuy03rAi9cffK1MtrjUJBCfi2v3RA9pPoBdf3L9ldG4n6v5VoaZMjc6QaR5 QYuNB67vqI/BgvF4f4Ol/Zn1AhKAtTJ0/xZQGTOWDqUUOmlK+o+RbtwEF4ILpomRYrYa 7emQ70vT13XH604m/O407K2gMzNR/IsE5B2qQtj2s5rzOcxRyPFerTVrMWo9Wote8547 Nx6kgh3orYBVyAIV9vabI2xgf28KKL/yk/0Ss2j7emTBmzs8nG/MSZ95Kon/1thUGoze Vwii0Gmuvk9OgG+TWIab6z/UskG9caCK+1IhSALOa4c+RHME2H24oPlhhw6YcbkGtNNx 3ERQ== 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 v7si128572edd.551.2020.07.28.16.01.38; Tue, 28 Jul 2020 16:02:00 -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 S1730301AbgG1W6W (ORCPT + 99 others); Tue, 28 Jul 2020 18:58:22 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:33774 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730026AbgG1W5g (ORCPT ); Tue, 28 Jul 2020 18:57:36 -0400 Received: by mail-qk1-f196.google.com with SMTP id l23so20499736qkk.0 for ; Tue, 28 Jul 2020 15:57:36 -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=EOrXDcIpu0+Rojg4/uOteaJXevmZGAY4mWywC4YjIo8=; b=kX0lGGarpP3Jv3fkxaG+3St/l2VSWLG3gFHAqWdjvoLzHjVCriA/aOtYlqsXpjbeXg i94JdO85yBY2VxlxleEqceWWRxtzoIEGBU2DtfiTT/VrFhlNKwcYdQa/PpA7SrW90N5+ SClLF9r+UHgeZhGXbqtiyHo6XX1M8lKbzNMWZcU0VtTxVYH8D0XUU891wrWFYeirXHxb RwCU7vpQrXaunOc7Hsoc92PwYg/0/OUC68WnSPZpGpyhL8NmFjRemOySLmPezquTY/cH +nKHuM9yfEb8Ye+EvuEd1NhfnVz42luQH92DlFoc1H16yTI9GnmO6pufwAhFhsgA5YFY Qa1Q== X-Gm-Message-State: AOAM53088kyvbLuJ2DhJCjRVnWtmIdpxP6de69nqmIN7Bcysl/R9H9a3 JjoCPQ4WVlDCpjKM2YVzZ8c= X-Received: by 2002:a37:9f48:: with SMTP id i69mr29693057qke.267.1595977055722; Tue, 28 Jul 2020 15:57:35 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 15:57:35 -0700 (PDT) From: Arvind Sankar To: Kees Cook , x86@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v3 15/21] x86/kaslr: Drop redundant check in store_slot_info Date: Tue, 28 Jul 2020 18:57:16 -0400 Message-Id: <20200728225722.67457-16-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 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 --- 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 a87800aa6eda..2f43b0d7051e 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; } /* -- 2.26.2