From: Hans de Goede <hdegoede@redhat.com>
To: Peter Jones <pjones@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: Thu, 5 Apr 2018 13:51:28 +0200 [thread overview]
Message-ID: <b43da07e-5ca6-ce06-c786-5dcbbfc4b300@redhat.com> (raw)
In-Reply-To: <20180403195332.tezh6alee26aic2s@redhat.com>
Hi,
On 03-04-18 21:53, Peter Jones wrote:
> 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.
As discussed elsewhere in the thread, I'm going to switch to doing a
kmemdup on the found firmware, so this chunk will go away :)
>
> ...
>> +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.
We break from the search loop as soon as a firmware is found, this can
only trigger if someone adds a second firmware to the dmi data and then
does not update MAX_EMBEDDED_FIRMWARES...
But mcgrof wants me to switch to a linked list here, so this is going
away too.
> Aside from those nits, looks good to me.
>
> Reviewed-by: Peter Jones <pjones@redhat.com>
Thanks, but v2 is going to have so much changes that I don't feel
comfortable bringing this forward to v2.
Regards,
Hans
next prev parent reply other threads:[~2018-04-05 11:51 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
2018-04-05 11:51 ` Hans de Goede [this message]
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 ` [RFC PATCH] efi: debugfs_blob[] can be static kbuild test robot
2018-04-01 0:12 ` [PATCH 1/2] efi: Export boot-services code and data as debugfs-blobs 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=b43da07e-5ca6-ce06-c786-5dcbbfc4b300@redhat.com \
--to=hdegoede@redhat.com \
--cc=ard.biesheuvel@linaro.org \
--cc=dave@bewaar.me \
--cc=gregkh@linuxfoundation.org \
--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=pjones@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