[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190705124646.GD2911@vkoul-mobl>
Date: Fri, 5 Jul 2019 18:16:46 +0530
From: Vinod Koul <vkoul@...nel.org>
To: Sven Van Asbroeck <thesven73@...il.com>
Cc: Robin Gong <yibin.gong@....com>,
Dan Williams <dan.j.williams@...el.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
dmaengine@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dmaengine: imx-sdma: fix use-after-free on probe error
path
On 24-06-19, 10:07, Sven Van Asbroeck wrote:
Quoting orignal patch for better context:
> + if (pdata) {
> + ret = sdma_get_firmware(sdma, pdata->fw_name);
> + if (ret)
> + dev_warn(&pdev->dev, "failed to get firmware from platform data\n");
> + } else {
> + /*
> + * Because that device tree does not encode ROM script address,
> + * the RAM script in firmware is mandatory for device tree
> + * probe, otherwise it fails.
> + */
> + ret = of_property_read_string(np, "fsl,sdma-ram-script-name",
> + &fw_name);
> + if (ret)
> + dev_warn(&pdev->dev, "failed to get firmware name\n");
> + else {
> + ret = sdma_get_firmware(sdma, fw_name);
> + if (ret)
> + dev_warn(&pdev->dev, "failed to get firmware from device tree\n");
> + }
> + }
> +
On 05-07-19, 08:26, Sven Van Asbroeck wrote:
> Hi Vinod,
>
> On Fri, Jul 5, 2019 at 3:32 AM Vinod Koul <vkoul@...nel.org> wrote:
> >
> > > + if (ret)
> > > + dev_warn(&pdev->dev, "failed to get firmware name\n");
> >
> > if should have braces!
> > Applied after fixing braces!
>
> checkpatch.pl output after adding braces:
>
> WARNING: braces {} are not necessary for single statement blocks
> #102: FILE: drivers/dma/imx-sdma.c:2165:
> + if (ret) {
> + dev_warn(&pdev->dev, "failed to get firmware from device tree\n");
> + }
there is an else here too!
With the patch the checkpatch warns:
CHECK: braces {} should be used on all arms of this statement
#201: FILE: drivers/dma/imx-sdma.c:2161:
+ if (ret)
[...]
+ else {
[...]
Even if the if is a single block and else being multi block, if would
need matching brances. With the change pushed:
total: 0 errors, 0 warnings, 0 checks, 60 lines checked
--
~Vinod
Powered by blists - more mailing lists