From patchwork Fri Aug 25 15:50:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 111034 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1219490qge; Fri, 25 Aug 2017 08:59:51 -0700 (PDT) X-Received: by 10.84.133.111 with SMTP id 102mr11062551plf.277.1503676791859; Fri, 25 Aug 2017 08:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503676791; cv=none; d=google.com; s=arc-20160816; b=wqu4WvIUgQc32fPxakl20ui+/nste/LY/zbtX0zUOrUneZ5qvAK0NypTX7fWhPGQbz rAXJw7sCG5OPd46IYkTt0Hy58RsqSs7lrpI0emVtjUpzZTvn+9acACfU0UcAtYs1F1lf CjXRLcfYl69Uge4d8W9yN84AfJ/8+VUfmwAH/dl88lo8puyO35RblYfZsNJW3IjnYE9S SDRutdfDtAxBMICZQj+jXZJlO1o0t2ULecAMi/XuHnd3CNbVExS3bpLGO+7dlGPMSVq0 OvjEJy5CM3U93YSnTMJUFk+akJThz1/xpBVK1DqhXaty0ZNf2oV8BHhv4ktwo4IVbwN2 LHNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=UXlGPp/xPY9UYIw6wrwcGqC8u4mZqngYVHii4Fb09Kc=; b=wf2hUaJAJdb5gbYJ6Kwyeg+735KaAEYPgl4t0/lEA6e9yZ3i1f+iIHz9YZxVGO3wO+ V/Z+RPCTp1BvQCFZkE1txbtPgv8Kk5GDMPH6stPczti9UdRiOXfuxcUCj0b2QhrJ+Miv tGeUrX0AiNxW+mvnIe6+9XEXlGhfjWCsPaHa8H94mAlCPuuZO7uShnUXqNXddPMR0Qb2 VAZdpVcjMdbWKVNl7K2eKaSut/D/cjz1t7nKknmzXiib3JtpUUJj/9FCNM5lii9bKLPH tv6LHuLpSUdENEwV0pzpRuuWH+WRgC+Q2ZeOOHowO4kR0nYxI03LzN6crBn7xswu6IZf gYTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e46Tdt0r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 m19si4929261pgk.551.2017.08.25.08.59.51; Fri, 25 Aug 2017 08:59:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=e46Tdt0r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S934142AbdHYP7t (ORCPT + 26 others); Fri, 25 Aug 2017 11:59:49 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38323 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934116AbdHYP7j (ORCPT ); Fri, 25 Aug 2017 11:59:39 -0400 Received: by mail-wm0-f51.google.com with SMTP id z132so1694926wmg.1 for ; Fri, 25 Aug 2017 08:59:38 -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:in-reply-to:references; bh=UXlGPp/xPY9UYIw6wrwcGqC8u4mZqngYVHii4Fb09Kc=; b=e46Tdt0raGyRfCyIJkCIfpXi1Fu6leRBtPu6k3BTojS2jxEluQh7l+UU2ZaerYFMGV zuIlP4pcBcnVG7Y6UwIcir2XIA4FH2kTxBEVWAEpQteJDnsbWWW/eOhGNbZFdloWm9Mt SiH9qaJB1Mn+5GRAtycML/ryYAWhWpneQbWGA= 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; bh=UXlGPp/xPY9UYIw6wrwcGqC8u4mZqngYVHii4Fb09Kc=; b=Mo7GLlmV4ugRCYsdedCN7cs854mcCG8BOhKuceBqPxRCYu02+0m/JqC9SBnina8RJb lZx4/ps9+1G8awPYxTVkwUZT8L+KBkTnC5U5cKZilUUx9k6U4nYTxctnMb2G6R8TLoMR Mom668AojwcB73P39HzWh9+6v16YX/ybyrc93fTI909xWXkt4M/Bx45MX9/l5+9y6OiQ 327mnVPllp0IYvaBMkdiCcDhJL2aLriYgwDo0SBdBaRNz/AYfCxDxYwRaG6eYmh7cr56 yt2lctiNk4w2VGpVNAjwQiZC8Y/SrVijOldJ+6B9iQRrzmg09ziA0PFnt1YaMgftYker omng== X-Gm-Message-State: AHYfb5iHWyT4BtRA8L7IeENs7ob+5nwvHrytvkC22IH5N/nJ0rjupM7U I/0nCosihJktUbrJ X-Received: by 10.28.155.194 with SMTP id d185mr1473174wme.157.1503676778193; Fri, 25 Aug 2017 08:59:38 -0700 (PDT) Received: from localhost.localdomain ([105.137.125.182]) by smtp.gmail.com with ESMTPSA id b96sm14507757wrd.94.2017.08.25.08.59.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Aug 2017 08:59:37 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Jan Beulich , Ard Biesheuvel , linux-kernel@vger.kernel.org, Jan Beulich , Matt Fleming Subject: [PATCH 5/5] efi: bgrt: use efi_mem_type() Date: Fri, 25 Aug 2017 16:50:19 +0100 Message-Id: <20170825155019.6740-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170825155019.6740-1-ard.biesheuvel@linaro.org> References: <20170825155019.6740-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Beulich Avoid effectively open-coding the function. Signed-off-by: Jan Beulich Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/efi-bgrt.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) -- 2.11.0 diff --git a/drivers/firmware/efi/efi-bgrt.c b/drivers/firmware/efi/efi-bgrt.c index b58233e4ed71..50793fda7819 100644 --- a/drivers/firmware/efi/efi-bgrt.c +++ b/drivers/firmware/efi/efi-bgrt.c @@ -27,26 +27,6 @@ struct bmp_header { u32 size; } __packed; -static bool efi_bgrt_addr_valid(u64 addr) -{ - efi_memory_desc_t *md; - - for_each_efi_memory_desc(md) { - u64 size; - u64 end; - - if (md->type != EFI_BOOT_SERVICES_DATA) - continue; - - size = md->num_pages << EFI_PAGE_SHIFT; - end = md->phys_addr + size; - if (addr >= md->phys_addr && addr < end) - return true; - } - - return false; -} - void __init efi_bgrt_init(struct acpi_table_header *table) { void *image; @@ -85,7 +65,7 @@ void __init efi_bgrt_init(struct acpi_table_header *table) goto out; } - if (!efi_bgrt_addr_valid(bgrt->image_address)) { + if (efi_mem_type(bgrt->image_address) != EFI_BOOT_SERVICES_DATA) { pr_notice("Ignoring BGRT: invalid image address\n"); goto out; }