[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jKFceOXHtusm9e8qQ_2_ikpFtghmp5ZD9+i9C+aF7200g@mail.gmail.com>
Date: Tue, 12 Feb 2019 12:11:59 -0800
From: Kees Cook <keescook@...omium.org>
To: Yue Hu <huyue2@...ong.com>
Cc: Anton Vorontsov <anton@...msg.org>,
Colin Cross <ccross@...roid.com>,
Tony Luck <tony.luck@...el.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] pstore/ram: Make initialization check as first one
On Sun, Jan 27, 2019 at 6:11 PM Yue Hu <huyue2@...ong.com> wrote:
>
> From 4320c0fcb5d685c8099937abce88e0b7fbbfe8dc Mon Sep 17 00:00:00 2001
> From: Yue Hu <huyue2@...ong.com>
> Date: Wed, 23 Jan 2019 16:56:48 +0800
> Subject: [PATCH] pstore/ram: Make initialization check as first one
>
> Since only one single ramoops area allowed at a time, other probes
> include device tree related are meaningless, it will waste cpu
> consumtion. So let's check it firstly.
>
> Signed-off-by: Yue Hu <huyue2@...ong.com>
> ---
> fs/pstore/ram.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index 1adb5e3..ca01778 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -715,15 +715,6 @@ static int ramoops_probe(struct platform_device *pdev)
> phys_addr_t paddr;
> int err = -EINVAL;
>
> - if (dev_of_node(dev) && !pdata) {
> - pdata = &pdata_local;
> - memset(pdata, 0, sizeof(*pdata));
> -
> - err = ramoops_parse_dt(pdev, pdata);
> - if (err < 0)
> - goto fail_out;
> - }
> -
> /*
> * Only a single ramoops area allowed at a time, so fail extra
> * probes.
> @@ -733,6 +724,15 @@ static int ramoops_probe(struct platform_device *pdev)
> goto fail_out;
> }
>
> + if (dev_of_node(dev) && !pdata) {
> + pdata = &pdata_local;
> + memset(pdata, 0, sizeof(*pdata));
> +
> + err = ramoops_parse_dt(pdev, pdata);
> + if (err < 0)
> + goto fail_out;
> + }
> +
> /* Make sure we didn't get bogus platform data pointer. */
> if (!pdata) {
> pr_err("NULL platform data\n");
> --
> 1.9.1
Applied, thanks!
--
Kees Cook
Powered by blists - more mailing lists