linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: qcom_hidma: avoid freeing an uninitialized pointer
@ 2017-08-10 15:54 Anton Vasilyev
  2017-08-10 16:17 ` Sinan Kaya
  2017-08-21 16:21 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Anton Vasilyev @ 2017-08-10 15:54 UTC (permalink / raw)
  To: Andy Gross
  Cc: Anton Vasilyev, David Brown, Dan Williams, Vinod Koul,
	linux-arm-msm, linux-soc, dmaengine, linux-kernel, ldv-project

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 <vasilyev@ispras.ru>
---
 drivers/dma/qcom/hidma_mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
index 5a0991b..89e36e3 100644
--- a/drivers/dma/qcom/hidma_mgmt.c
+++ b/drivers/dma/qcom/hidma_mgmt.c
@@ -354,7 +354,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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: qcom_hidma: avoid freeing an uninitialized pointer
  2017-08-10 15:54 [PATCH] dmaengine: qcom_hidma: avoid freeing an uninitialized pointer Anton Vasilyev
@ 2017-08-10 16:17 ` Sinan Kaya
  2017-08-21 16:21 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Sinan Kaya @ 2017-08-10 16:17 UTC (permalink / raw)
  To: Anton Vasilyev, Andy Gross
  Cc: David Brown, Dan Williams, Vinod Koul, linux-arm-msm, linux-soc,
	dmaengine, linux-kernel, ldv-project

On 8/10/2017 11:54 AM, Anton Vasilyev wrote:
> 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 <vasilyev@ispras.ru>
> ---
>  drivers/dma/qcom/hidma_mgmt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
> index 5a0991b..89e36e3 100644
> --- a/drivers/dma/qcom/hidma_mgmt.c
> +++ b/drivers/dma/qcom/hidma_mgmt.c
> @@ -354,7 +354,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;
> 

Reviewed-by: Sinan Kaya <okaya@codeaurora.org>

-- 
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: qcom_hidma: avoid freeing an uninitialized pointer
  2017-08-10 15:54 [PATCH] dmaengine: qcom_hidma: avoid freeing an uninitialized pointer Anton Vasilyev
  2017-08-10 16:17 ` Sinan Kaya
@ 2017-08-21 16:21 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2017-08-21 16:21 UTC (permalink / raw)
  To: Anton Vasilyev
  Cc: Andy Gross, David Brown, Dan Williams, linux-arm-msm, linux-soc,
	dmaengine, linux-kernel, ldv-project

On Thu, Aug 10, 2017 at 06:54:25PM +0300, Anton Vasilyev wrote:
> 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).

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-21 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-10 15:54 [PATCH] dmaengine: qcom_hidma: avoid freeing an uninitialized pointer Anton Vasilyev
2017-08-10 16:17 ` Sinan Kaya
2017-08-21 16:21 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).