Received: by 10.213.65.68 with SMTP id h4csp3911882imn; Tue, 3 Apr 2018 12:55:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/fFYKk9oXZKQnXvrHgjpK63H9d5fif3Vsf8I4pD4WqRdRKTonIFyPUJbolK3u1m/u9I41C X-Received: by 2002:a17:902:7102:: with SMTP id a2-v6mr15369761pll.87.1522785348232; Tue, 03 Apr 2018 12:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522785348; cv=none; d=google.com; s=arc-20160816; b=RSvw7PZs9unTjYwoZFk3qmi7icauaMhmUtdSTADwSWTrzsK1epSTh6ZbMoLzr9EWBW krMavJ2NOZIsRcYQKkgaPI04DDPWYERh8PVaYze5XQqoVLAyH2riFyGoHdOg5LRDI1Q5 nD0bdWgijz1zHW/W8VTQouWD4QUzlFmyhh0WnvZZfeGDSrFm+Dh0gPY0ImsXKr3MbKeC Bty2ZzjVVrwodvjphiHaEs6x7Ior+xfcUQD5QauGFjUhaolJRXoq5jIFLT0fdWtejXVf 2FuuG7z7Qa68IuBRyt/3KBN6FADhfj3DckiqMyNhNj3T2aATwZIvCbTyfRtisBBQ7+tr in9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=TnE6LmlqoREm9nppaIJ2pnPK2WM6TCUppuQ7QZ2veJk=; b=FXHavUScuZY5ZdpzpUOiRgQHbwEc3ImwXxDsygwMvc1x/B57ZA/kU8cuw5ke84JVhn d3LfXS4+WSsyeIhgGfSb5i58cYNcc0ME0qlyLPvJQYXImpiZFS2xdRn92yRlHIoWpuw9 KbVdoXp9qhthhu4QfSSXUcHv7moShgW+RmdS8TahITDhBfcpv+KK1/8C5Y9T1O+TiQl8 /dU4F87hTkMZChZNOVtx/en+ES080ZtMyEGs6CU3Z3iLoPl+ZHH10xPw/CKHow/3kuer Op4gAaYOo9oriy2v7ILO/BiXXGrhiAYsDfhLboJiR5x504LvsybNDqGKYRMqcKksjO4L Q+Zg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13-v6si1328096ply.163.2018.04.03.12.55.33; Tue, 03 Apr 2018 12:55:48 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753354AbeDCTxi (ORCPT + 99 others); Tue, 3 Apr 2018 15:53:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46814 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753156AbeDCTxg (ORCPT ); Tue, 3 Apr 2018 15:53:36 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EB937CBBA; Tue, 3 Apr 2018 19:53:36 +0000 (UTC) Received: from redhat.com (dhcp-10-20-1-221.bss.redhat.com [10.20.1.221]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C51447C55; Tue, 3 Apr 2018 19:53:35 +0000 (UTC) Date: Tue, 3 Apr 2018 12:53:34 -0700 From: Peter Jones To: Hans de Goede Cc: Ard Biesheuvel , "Luis R . Rodriguez" , Greg Kroah-Hartman , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , linux-kernel@vger.kernel.org, Dave Olsthoorn , x86@kernel.org, linux-efi@vger.kernel.org Subject: Re: [PATCH 2/2] efi: Add embedded peripheral firmware support Message-ID: <20180403195332.tezh6alee26aic2s@redhat.com> References: <20180331121944.8618-1-hdegoede@redhat.com> <20180331121944.8618-2-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180331121944.8618-2-hdegoede@redhat.com> User-Agent: NeoMutt/20171215 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 03 Apr 2018 19:53:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 03 Apr 2018 19:53:36 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pjones@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 31, 2018 at 02:19:44PM +0200, Hans de Goede wrote: > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c > index fddc5f706fd2..1a5ea950f58f 100644 > --- a/drivers/firmware/efi/efi.c > +++ b/drivers/firmware/efi/efi.c > @@ -455,6 +455,7 @@ int __init efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) > u64 end; > > if (!(md->attribute & EFI_MEMORY_RUNTIME) && > + md->type != EFI_BOOT_SERVICES_CODE && > md->type != EFI_BOOT_SERVICES_DATA && > md->type != EFI_RUNTIME_SERVICES_DATA) { > continue; Might be worth adding a comment here to ensure nobody comes along later and adds something like EFI_BOOT_LOADER_DATA or other stuff that's allocated later here. I don't want to accidentally patch our way into having the ability to stumble across a firmware blob somebody dumped into the middle of a grub config file, especially since you only need to collide crc32 (within the same length) to pre-alias a match. ... > +static int __init efi_check_md_for_embedded_firmware( > + efi_memory_desc_t *md, const struct embedded_fw_desc *desc) > +{ ... > + if (found_fw_count >= MAX_EMBEDDED_FIRMWARES) { > + pr_err("Error already have %d embedded firmwares\n", > + MAX_EMBEDDED_FIRMWARES); > + return -ENOSPC; > + } Doesn't seem like this needs to be pr_err(); after all we have already found a valid match, so the firmware vendor has done something moderately stupid, but we have a firmware that will probably work. Of course it still needs to return != 0, but pr_warn() or even pr_info() seems more reasonable. Aside from those nits, looks good to me. Reviewed-by: Peter Jones -- Peter