From: Matt Fleming <matt@codeblueprint.co.uk>
To: Octavian Purdila <octavian.purdila@intel.com>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
Len Brown <lenb@kernel.org>, Mark Brown <broonie@kernel.org>,
Wolfram Sang <wsa@the-dreams.de>,
Joel Becker <jlbec@evilplan.org>,
linux-acpi@vger.kernel.org, linux-efi@vger.kernel.org,
linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org, irina.tirdea@intel.com,
leonard.crestez@intel.com
Subject: Re: [PATCH v5 6/8] efi: load SSTDs from EFI variables
Date: Mon, 4 Jul 2016 13:00:36 +0100 [thread overview]
Message-ID: <20160704120036.GJ8415@codeblueprint.co.uk> (raw)
In-Reply-To: <1467404352-27101-7-git-send-email-octavian.purdila@intel.com>
(Sorry, didn't get chance to reply before you sent this version)
On Fri, 01 Jul, at 11:19:10PM, Octavian Purdila wrote:
> +
> +static __init int efivar_ssdt_load(void)
> +{
> + struct efivar_entry *entry;
> + /* We need a temporary empty list to be able to set duplicates
> + * to true so that the efivar lock is dropped to allow us to
> + * call efivar_entry_get from the iterator function.
> + */
> + LIST_HEAD(tmp);
> + int ret;
I suspect you actually want to enable duplicate detection though,
because that bug (GetNextVariable() returning the same variable over
and over) does exist in the wild and it isn't that much more work to
enable the check.
Yes, the stack-local list looks like the right approach, because you
don't need access to these entries once this function returns.
Just be sure to free all those entries after efivar_init(), which
doesn't need to be done under efivar_entry_iter_{begin,end}() because
no one can concurrently access the list anyway.
Also...
/*
* Multi-line comments should look like this, with the empty
* first line.
*/
> +
> + /* efivar_entry is too big to allocate it on stack */
> + entry = kmalloc(sizeof(*entry), GFP_KERNEL);
> + if (!entry)
> + return -ENOMEM;
> + ret = efivar_init(efivar_ssdt_iter, entry, true, &tmp);
> + kfree(entry);
> + return ret;
> +}
> +#else
> +static inline int efivar_ssdt_load(void) { return 0; }
> +#endif
My suggestion is,
- Push the 'entry' allocation into efivar_ssdt_iter()
- Add 'entry' to the stack-local tmp list via efivar_entry_add()
- Iterate 'tmp' and free entries before returning from efivar_ssdt_load()
Make sense?
next prev parent reply other threads:[~2016-07-04 12:00 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-01 20:19 [PATCH v5 0/8] ACPI overlays Octavian Purdila
2016-07-01 20:19 ` [PATCH v5 2/8] acpi: fix enumeration (visited) flags for bus rescans Octavian Purdila
2016-07-06 15:03 ` Mika Westerberg
2016-07-06 15:37 ` Octavian Purdila
2016-07-06 21:09 ` Rafael J. Wysocki
[not found] ` <31239967.dEXrvihxAE-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2016-07-07 9:00 ` Mika Westerberg
2016-07-07 9:28 ` Mika Westerberg
2016-07-01 20:19 ` [PATCH v5 3/8] acpi: add support for ACPI reconfiguration notifiers Octavian Purdila
2016-07-07 9:34 ` Mika Westerberg
2016-07-01 20:19 ` [PATCH v5 4/8] i2c: add support for ACPI reconfigure notifications Octavian Purdila
2016-07-04 0:34 ` Wolfram Sang
[not found] ` <1467404352-27101-1-git-send-email-octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-01 20:19 ` [PATCH v5 1/8] Documentation: acpi: add SSDT overlays documentation Octavian Purdila
[not found] ` <1467404352-27101-2-git-send-email-octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-07 9:25 ` Mika Westerberg
2016-07-01 20:19 ` [PATCH v5 5/8] spi: add support for ACPI reconfigure notifications Octavian Purdila
2016-07-03 12:10 ` Mark Brown
2016-07-01 20:19 ` [PATCH v5 6/8] efi: load SSTDs from EFI variables Octavian Purdila
2016-07-02 8:18 ` Geert Uytterhoeven
2016-07-04 12:00 ` Matt Fleming [this message]
2016-07-06 0:34 ` [PATCH v5 0/8] ACPI overlays Rafael J. Wysocki
2016-07-06 6:29 ` Octavian Purdila
2016-07-01 20:19 ` [PATCH v5 7/8] acpi: add support for configfs Octavian Purdila
2016-07-07 9:39 ` Mika Westerberg
2016-07-01 20:19 ` [PATCH v5 8/8] acpi: add support for loading SSDTs via configfs Octavian Purdila
2016-07-07 9:42 ` Mika Westerberg
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=20160704120036.GJ8415@codeblueprint.co.uk \
--to=matt@codeblueprint.co.uk \
--cc=broonie@kernel.org \
--cc=irina.tirdea@intel.com \
--cc=jlbec@evilplan.org \
--cc=lenb@kernel.org \
--cc=leonard.crestez@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=octavian.purdila@intel.com \
--cc=rjw@rjwysocki.net \
--cc=wsa@the-dreams.de \
/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;
as well as URLs for NNTP newsgroup(s).