From: Anton Vasilyev Date: Thu, 10 Aug 2017 15:54:25 +0000 (+0300) Subject: dmaengine: qcom_hidma: avoid freeing an uninitialized pointer X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a63efead7f8eeefcf08e4e7d0b033ac552f7da23;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git dmaengine: qcom_hidma: avoid freeing an uninitialized pointer If device_node np doesn't contain child or first child doesn't have property "reg" then hidma_mgmt_of_populate_channels() perfoms deallocation on uninitialized local variable res. The patch adds res initialization by NULL. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Anton Vasilyev Reviewed-by: Sinan Kaya Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c index c45e244b2d99..7335e2eb9b72 100644 --- a/drivers/dma/qcom/hidma_mgmt.c +++ b/drivers/dma/qcom/hidma_mgmt.c @@ -358,7 +358,7 @@ static int __init hidma_mgmt_of_populate_channels(struct device_node *np) struct platform_device_info pdevinfo; struct of_phandle_args out_irq; struct device_node *child; - struct resource *res; + struct resource *res = NULL; const __be32 *cell; int ret = 0, size, i, num; u64 addr, addr_size;