Re: [PATCH] dmaengine: imx-sdma: fix use-after-free on probe error path
From: Vinod Koul <vkoul@kernel.org>
Date: 2019-07-05 12:50:09
Also in:
dmaengine, lkml
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 [off-list ref] wrote:quoted
quoted
+ 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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel