public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Jones <pjones@redhat.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"Luis R . Rodriguez" <mcgrof@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org, Dave Olsthoorn <dave@bewaar.me>,
	x86@kernel.org, linux-efi@vger.kernel.org
Subject: Re: [PATCH 2/2] efi: Add embedded peripheral firmware support
Date: Tue, 3 Apr 2018 12:53:34 -0700	[thread overview]
Message-ID: <20180403195332.tezh6alee26aic2s@redhat.com> (raw)
In-Reply-To: <20180331121944.8618-2-hdegoede@redhat.com>

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 <pjones@redhat.com>

-- 
  Peter

  parent reply	other threads:[~2018-04-03 19:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-31 12:19 [PATCH 1/2] efi: Export boot-services code and data as debugfs-blobs Hans de Goede
2018-03-31 12:19 ` [PATCH 2/2] efi: Add embedded peripheral firmware support Hans de Goede
2018-04-01  0:19   ` kbuild test robot
2018-04-01  0:22   ` kbuild test robot
2018-04-02 23:23   ` Luis R. Rodriguez
2018-04-03  8:33     ` Hans de Goede
2018-04-03 18:07       ` Lukas Wunner
2018-04-03 18:58         ` Luis R. Rodriguez
2018-04-04 17:18           ` Peter Jones
2018-04-04 20:25             ` Hans de Goede
2018-04-05  0:28               ` Ard Biesheuvel
2018-04-05  5:43             ` Lukas Wunner
2018-04-06 14:08               ` Luis R. Rodriguez
2018-04-06 14:14                 ` Ard Biesheuvel
2018-04-06 14:28                   ` Ard Biesheuvel
2018-04-07  9:51                 ` Lukas Wunner
2018-04-07 11:13                 ` Hans de Goede
2018-04-06 14:16               ` Peter Jones
2018-04-03 18:47       ` Luis R. Rodriguez
2018-04-05 13:54         ` Hans de Goede
2018-04-03 19:53   ` Peter Jones [this message]
2018-04-05 11:51     ` Hans de Goede
2018-03-31 14:10 ` [PATCH 1/2] efi: Export boot-services code and data as debugfs-blobs Greg Kroah-Hartman
2018-03-31 16:57   ` Hans de Goede
2018-04-01  0:12 ` kbuild test robot
2018-04-01  0:12 ` [RFC PATCH] efi: debugfs_blob[] can be static kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180403195332.tezh6alee26aic2s@redhat.com \
    --to=pjones@redhat.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=dave@bewaar.me \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox