[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdVJENz5wnOV=TX5cVdTsOZD25SwprSLpetZpAsMcPtvEA@mail.gmail.com>
Date: Thu, 14 Mar 2019 08:30:07 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Kangjie Lu <kjlu@....edu>
Cc: pakki001@....edu, Simon Horman <horms@...ge.net.au>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
linux-pci <linux-pci@...r.kernel.org>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] pci: pcie-rcar: fix a potential NULL pointer dereference
Hi Kangjie,
On Thu, Mar 14, 2019 at 6:56 AM Kangjie Lu <kjlu@....edu> wrote:
> In case __get_free_pages fails and returns NULL, the fix returns
> -ENOMEM and releases resources to avoid NULL pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>
Thanks for your patch!
> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -929,6 +929,12 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
>
> /* setup MSI data target */
> msi->pages = __get_free_pages(GFP_KERNEL, 0);
> + if (!msi->pages) {
> + dev_err(dev, "failed to get free pages\n");
Please drop the dev_err().
The memory allocation core will already have printed a warning, cfr.
warn_alloc() in mm/page_alloc.c.
With that fixed:
Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>
> + err = -ENOMEM;
> + goto err;
> + }
> +
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists