From patchwork Wed Sep 11 23:32:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 173651 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp1396331ilq; Wed, 11 Sep 2019 16:33:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0Lrc6VZS1f3LZ7RNz+wVOhlFLhRHgC4Vgtd3cCYwOgoB14Y1N9R85PR8wnjE2DA542erR X-Received: by 2002:a50:eb81:: with SMTP id y1mr38705583edr.216.1568244780869; Wed, 11 Sep 2019 16:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568244780; cv=none; d=google.com; s=arc-20160816; b=xo5h/JNz/NAd3jucA3jMffWfsEZRoE8Fd578MD4FXJ0EAy5dUjwbpktnrm8f7lPkNq MXr7nIh7MLkU7xMjPcPN2ggWtFF7qo16UcmTp1H55CD1fC3o+aF5MCQ2WyvaTl0OkS1Z H02AjBKfe36h4qON6oq4o2Q8QYQeWJsfeG+msUA2Ci5Qcbg1SMDUJKdEFiTySeatsP51 o7ljrT5aYFaKlXp0UsQk6OQUQzmX2EIooaDrE0Z6dxL18eRrq2eLyxh/d9xBA/BVeX03 Csrih5n61aUgX/QfaXlsxw2+CyYO7LMhY3gjieXd6SoJmpraA9+nm4wjXK49YbbxlvJs 7c7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=4JyiQhNZp69tVYahTTgOF5xpVVj7nM2maQxT9CgovkU=; b=n7jfsNuYBDDAkS+qBt0DKnqJ+fLn47B3850deJqtm1q3R+S9aVMwHYYaFB0gH9kD+l KN31eiwUkmRVflKkH5JcqBDX6wMPlnCeZrhOp6mGNHknpd32i/+jJ2yfdD0M4yZ3YV1p SVRQSOpaMBc6eNyHcQD89PVj81UU6rETHigeTd6voMKYRKw8h6Vbyei/2BDC/fGDx0Ma XPSRcRbDRbcoyk+XYIzJqsJevcLpp6C7t9/p/wbxptjOG3s76J1ixbv1VhGwjgzIzRYr KYKfAylQ6lqXMhDAKoXRbojr7tt1mvExhNdSipOvVNm1aVTGoppzPgfNk9OoAdTfQJVa puig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VbxdGNtG; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si11360927edr.350.2019.09.11.16.33.00; Wed, 11 Sep 2019 16:33:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VbxdGNtG; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726761AbfIKXc5 (ORCPT + 3 others); Wed, 11 Sep 2019 19:32:57 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38206 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726525AbfIKXc4 (ORCPT ); Wed, 11 Sep 2019 19:32:56 -0400 Received: by mail-wm1-f67.google.com with SMTP id o184so5429019wme.3 for ; Wed, 11 Sep 2019 16:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=4JyiQhNZp69tVYahTTgOF5xpVVj7nM2maQxT9CgovkU=; b=VbxdGNtGsLH0P4TPj+YivKBSvK7ZjUqeGp3IaBhxViRoGlRBi1MnC/nOeg73oOQuPo T2hB4/PK4I/Uoymq3/betmUuvWG050fmOPBceBsbJtMJo79mF15TkoAbBQmZCJGlJCul J9w7bzKjucQF+O/FBPwFHlKiadbEroAtjy1OMizb/xnQr1Y7GIqtpMgAZNy8v21Zjom2 nsWt3knEwEJDqRkeS0narvNwMEAur8vxIkWamr5YnEQn1bEY3r31qwjPfKSA7+7ckmoD dOsHOHIPc3OlBcQYvCN72GQMY5+pggohHD9iO6zXeb5g+UT7VMsK/hLFSTwxvw0XL2KD gPfg== 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; bh=4JyiQhNZp69tVYahTTgOF5xpVVj7nM2maQxT9CgovkU=; b=GpwblhCeTC7rYog3x7yqtmJYiQw6QguahYE+DisccZd/UIVrmL6Ixdl8rDDew5Rz/K TTUPe5Ui2Vk8F2rMkG7GDx/F+1IUSqsBwWx+Y3mrpTPXYt+eIL5cBgx2xLZPVBC5a7OC jCDuRu3YLDcvbYQ/1M72PQbNwfi8oAi7GID139XdIU3dQKo8Fy6IkE4x5t80x26UNYQf kk5CzAaaiBIYuv73Li//zloMhvm1OAlGaVrqMQ1hZ4WY1ue+yUBXPG3tg0e28KVXjjyr i314oTyXV+KzHhD1MTeAtO7Ais/2gVoYKCckQ6WAlBSbUKBHgibFgcBeGYEIxWybTxcz yjnA== X-Gm-Message-State: APjAAAUlcojGuQ31zcyL+Or983WXFcvhChx+UbJhPX+aoRTPgR+FUFvI tPKRXjPmRpZk44d/cxUWeHCHU9xieOUMKIvT X-Received: by 2002:a1c:1a4b:: with SMTP id a72mr5823762wma.44.1568244774955; Wed, 11 Sep 2019 16:32:54 -0700 (PDT) Received: from e111045-lin.nice.arm.com ([148.69.85.38]) by smtp.gmail.com with ESMTPSA id c3sm32131637wrh.55.2019.09.11.16.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2019 16:32:54 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: Ard Biesheuvel , Scott Talbert Subject: [PATCH] efi: don't iterate over EFI vars pointlessly if no SSDT override was specified Date: Thu, 12 Sep 2019 00:32:39 +0100 Message-Id: <20190911233239.5916-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The kernel command line option efivar_ssdt= allows a EFI variable name to be specified which contains an ACPI SSDT table that will be loaded into memory by the OS. Currently, that code will always iterate over the EFI variables and compare each name with the provided name, even if the command line option wasn't set to begin with. So bail early when no variable name was provided. Cc: Scott Talbert Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/efi.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index ad3b1f4866b3..8f020827cdd3 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -282,6 +282,9 @@ static __init int efivar_ssdt_load(void) void *data; int ret; + if (!efivar_ssdt[0]) + return 0; + ret = efivar_init(efivar_ssdt_iter, &entries, true, &entries); list_for_each_entry_safe(entry, aux, &entries, list) {