Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1798866pxa; Thu, 6 Aug 2020 16:40:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXrCw33WI2HV8lhQWbpB+N+lakTLEqBU50SXc1vMZTRw80CinUaScAYoKKDmbOGNOP1Yp/ X-Received: by 2002:a17:906:3449:: with SMTP id d9mr6890250ejb.460.1596757244739; Thu, 06 Aug 2020 16:40:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596757244; cv=none; d=google.com; s=arc-20160816; b=FqHcWE/L8PT/0/p0iYgAEet9OPQvTpPyQ1oKZtDP1RVnU54YwkWc2pvjJJUkkWP4PV rW5ChMuf5YDSqHVfp6FH1XVVvTpPpRgrbCS6yJg1jEXxvw9b2h+GDIMolzQkxxX9v0fE iXug3HDMn08rZRi4atKHGF6Y9QWsPeqbMtlbHbE9ALpMQvAwrNzRQHjAeGhY2C4ks61b c1t7aBqw6sHL9Ewgex4MQYXkwtqNoVLGcw4h3MROXJ743aCE5qq8B+Ub7CcmOGFDsA0x e06Mhz4n2d7NaQNJvPd3MndAP2mrGjkroK6dXHpwGjBTFoAO1Fxgdj1qxFpK8sc6VYx+ fybA== 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=NRy200Kpf4NnYVl0QfDk0nBUrm1f1yuZ/hbZQNG/7+8=; b=YO7Y/4YTS3s0iV0jHWi6AmtjY4ZzTdP1dD+oaQ80MYQKih+wxB4b+7v+16SNddxjJt sJ6Q/ZyZzTnw5QuyoMtJFdMYE4cb8mDc0HoXGUDdopIm1EK7pH5SPEH3cYDT6dt5xWzC nQoc55/1V9XQDTUnBqacawzi4JwW5MPtYv3N6cRcwsVDBPWIJdYJiw0dL1sUBeQqVngQ 2oFPYibPVfqCXILMWL/2zFwszwq+AVGqNO6fNm+zt0jjZrdy8o8WCjWJIQ/wTq1LFnXT ia1hEds1s9/MHWWPsK/H1zYl1pUiQVUDvYYYihdwnUoLpIrb47kF/YRXQiRcfc24qkOW ZYdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=3bOdP1wC; 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 x20si4408300eju.35.2020.08.06.16.40.21; Thu, 06 Aug 2020 16:40:44 -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=3bOdP1wC; 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 S1726756AbgHFXjF (ORCPT + 99 others); Thu, 6 Aug 2020 19:39:05 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:60972 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726585AbgHFXi6 (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=1596757136; 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=NRy200Kpf4NnYVl0QfDk0nBUrm1f1yuZ/hbZQNG/7+8=; b=3bOdP1wCSXP5PR74QgDyZXOaaAQCI/dI4r2jrs2ZYLirjz3iicbceIO0zuvrPIDI0UTXLW qTaEMAypwr6AHH0nQYv7pSQflEUGb/25cRwfcQeYiZLWG+pSm0uiUvdcphqHyVUc9KB6Mq D7vE0VIvnZ2gnzoTlRq5wglhCEJggYCQTMZGvS5VMuHmiaIYIHdZqn8bUTx8VHJgni3g1a 94xW2KtUoEYqdUySgdIy3ak5BPXTHVn3dr0vHsoe1mTdmMSuCQ7JRqzcqufHiI+8wMw0rf ZvgFbaW7vdhZnstofVFRuGkIuOEToYCQtCZajn341mS5ACgrsVJrPMRsYCpF+A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1596757136; 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=NRy200Kpf4NnYVl0QfDk0nBUrm1f1yuZ/hbZQNG/7+8=; b=K/4LXZD4NVHsIRsLV0wJs37hluvA0y43fA6p1db1Ar5nmRjTX/v2HQZa/V7mPTWH6BLvLF 7cEKLJF9xO5goqCg== 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 test for command-line parameters before parsing Cc: Arvind Sankar , Ingo Molnar , x86 , LKML In-Reply-To: <20200728225722.67457-14-nivedita@alum.mit.edu> References: <20200728225722.67457-14-nivedita@alum.mit.edu> MIME-Version: 1.0 Message-ID: <159675713575.3192.10750788728765458633.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: 3870d971791f13df88a7a656e3fd6e2df8686097 Gitweb: https://git.kernel.org/tip/3870d971791f13df88a7a656e3fd6e2df8686097 Author: Arvind Sankar AuthorDate: Tue, 28 Jul 2020 18:57:14 -04:00 Committer: Ingo Molnar CommitterDate: Fri, 31 Jul 2020 11:08:17 +02:00 x86/kaslr: Drop test for command-line parameters before parsing This check doesn't save anything. In the case when none of the parameters are present, each strstr will scan args twice (once to find the length and then for searching), six scans in total. Just going ahead and parsing the arguments only requires three scans: strlen, memcpy, and parsing. This will be the first malloc, so free will actually free up the memory, so the check doesn't save heap space either. Signed-off-by: Arvind Sankar Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20200728225722.67457-14-nivedita@alum.mit.edu --- arch/x86/boot/compressed/kaslr.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 00ef84b..bd13dc5 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -279,10 +279,6 @@ static void handle_mem_options(void) if (!args) return; - if (!strstr(args, "memmap=") && !strstr(args, "mem=") && - !strstr(args, "hugepages")) - return; - len = strlen(args); tmp_cmdline = malloc(len + 1); if (!tmp_cmdline)