All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] irqchip/wpcm450: fix memory leak in wpcm450_aic_of_init()
@ 2022-11-15  9:25 ` Wei Yongjun
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Yongjun @ 2022-11-15  9:25 UTC (permalink / raw)
  To: Jonathan Neuschäfer, Thomas Gleixner, Marc Zyngier
  Cc: Wei Yongjun, openbmc, linux-kernel

From: Wei Yongjun <weiyongjun1@huawei.com>

If of_iomap() failed, 'aic' should be freed before return. Otherwise
there is a memory leak.

Fixes: fead4dd49663 ("irqchip: Add driver for WPCM450 interrupt controller")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
v1 -> v2: fix function name in subject

 drivers/irqchip/irq-wpcm450-aic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-wpcm450-aic.c b/drivers/irqchip/irq-wpcm450-aic.c
index 0dcbeb1a05a1..91df62a64cd9 100644
--- a/drivers/irqchip/irq-wpcm450-aic.c
+++ b/drivers/irqchip/irq-wpcm450-aic.c
@@ -146,6 +146,7 @@ static int __init wpcm450_aic_of_init(struct device_node *node,
 	aic->regs = of_iomap(node, 0);
 	if (!aic->regs) {
 		pr_err("Failed to map WPCM450 AIC registers\n");
+		kfree(aic);
 		return -ENOMEM;
 	}
 
-- 
2.34.1


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

* [PATCH v2] irqchip/wpcm450: fix memory leak in wpcm450_aic_of_init()
@ 2022-11-15  9:25 ` Wei Yongjun
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Yongjun @ 2022-11-15  9:25 UTC (permalink / raw)
  To: Jonathan Neuschäfer, Thomas Gleixner, Marc Zyngier
  Cc: openbmc, Wei Yongjun, linux-kernel

From: Wei Yongjun <weiyongjun1@huawei.com>

If of_iomap() failed, 'aic' should be freed before return. Otherwise
there is a memory leak.

Fixes: fead4dd49663 ("irqchip: Add driver for WPCM450 interrupt controller")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
v1 -> v2: fix function name in subject

 drivers/irqchip/irq-wpcm450-aic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-wpcm450-aic.c b/drivers/irqchip/irq-wpcm450-aic.c
index 0dcbeb1a05a1..91df62a64cd9 100644
--- a/drivers/irqchip/irq-wpcm450-aic.c
+++ b/drivers/irqchip/irq-wpcm450-aic.c
@@ -146,6 +146,7 @@ static int __init wpcm450_aic_of_init(struct device_node *node,
 	aic->regs = of_iomap(node, 0);
 	if (!aic->regs) {
 		pr_err("Failed to map WPCM450 AIC registers\n");
+		kfree(aic);
 		return -ENOMEM;
 	}
 
-- 
2.34.1


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

* Re: [PATCH v2] irqchip/wpcm450: fix memory leak in wpcm450_aic_of_init()
  2022-11-15  9:25 ` Wei Yongjun
@ 2022-11-15 16:57   ` Jonathan Neuschäfer
  -1 siblings, 0 replies; 5+ messages in thread
From: Jonathan Neuschäfer @ 2022-11-15 16:57 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Jonathan Neuschäfer, Thomas Gleixner, Marc Zyngier,
	Wei Yongjun, openbmc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]

On Tue, Nov 15, 2022 at 09:25:32AM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> If of_iomap() failed, 'aic' should be freed before return. Otherwise
> there is a memory leak.
> 
> Fixes: fead4dd49663 ("irqchip: Add driver for WPCM450 interrupt controller")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>


Thanks.

> ---
> v1 -> v2: fix function name in subject
> 
>  drivers/irqchip/irq-wpcm450-aic.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/irqchip/irq-wpcm450-aic.c b/drivers/irqchip/irq-wpcm450-aic.c
> index 0dcbeb1a05a1..91df62a64cd9 100644
> --- a/drivers/irqchip/irq-wpcm450-aic.c
> +++ b/drivers/irqchip/irq-wpcm450-aic.c
> @@ -146,6 +146,7 @@ static int __init wpcm450_aic_of_init(struct device_node *node,
>  	aic->regs = of_iomap(node, 0);
>  	if (!aic->regs) {
>  		pr_err("Failed to map WPCM450 AIC registers\n");
> +		kfree(aic);
>  		return -ENOMEM;
>  	}
>  
> -- 
> 2.34.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2] irqchip/wpcm450: fix memory leak in wpcm450_aic_of_init()
@ 2022-11-15 16:57   ` Jonathan Neuschäfer
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Neuschäfer @ 2022-11-15 16:57 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Marc Zyngier, openbmc, Jonathan Neuschäfer, linux-kernel,
	Wei Yongjun, Thomas Gleixner

[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]

On Tue, Nov 15, 2022 at 09:25:32AM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> If of_iomap() failed, 'aic' should be freed before return. Otherwise
> there is a memory leak.
> 
> Fixes: fead4dd49663 ("irqchip: Add driver for WPCM450 interrupt controller")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>


Thanks.

> ---
> v1 -> v2: fix function name in subject
> 
>  drivers/irqchip/irq-wpcm450-aic.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/irqchip/irq-wpcm450-aic.c b/drivers/irqchip/irq-wpcm450-aic.c
> index 0dcbeb1a05a1..91df62a64cd9 100644
> --- a/drivers/irqchip/irq-wpcm450-aic.c
> +++ b/drivers/irqchip/irq-wpcm450-aic.c
> @@ -146,6 +146,7 @@ static int __init wpcm450_aic_of_init(struct device_node *node,
>  	aic->regs = of_iomap(node, 0);
>  	if (!aic->regs) {
>  		pr_err("Failed to map WPCM450 AIC registers\n");
> +		kfree(aic);
>  		return -ENOMEM;
>  	}
>  
> -- 
> 2.34.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [irqchip: irq/irqchip-next] irqchip/wpcm450: Fix memory leak in wpcm450_aic_of_init()
  2022-11-15  9:25 ` Wei Yongjun
  (?)
  (?)
@ 2022-11-26 13:34 ` irqchip-bot for Wei Yongjun
  -1 siblings, 0 replies; 5+ messages in thread
From: irqchip-bot for Wei Yongjun @ 2022-11-26 13:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: Wei Yongjun, j.neuschaefer, Marc Zyngier, tglx

The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID:     4208d4faf36573a507b5e5de17abe342e9276759
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/4208d4faf36573a507b5e5de17abe342e9276759
Author:        Wei Yongjun <weiyongjun1@huawei.com>
AuthorDate:    Tue, 15 Nov 2022 09:25:32 
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Sat, 26 Nov 2022 13:29:48 

irqchip/wpcm450: Fix memory leak in wpcm450_aic_of_init()

If of_iomap() failed, 'aic' should be freed before return. Otherwise
there is a memory leak.

Fixes: fead4dd49663 ("irqchip: Add driver for WPCM450 interrupt controller")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221115092532.1704032-1-weiyongjun@huaweicloud.com
---
 drivers/irqchip/irq-wpcm450-aic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-wpcm450-aic.c b/drivers/irqchip/irq-wpcm450-aic.c
index 0dcbeb1..91df62a 100644
--- a/drivers/irqchip/irq-wpcm450-aic.c
+++ b/drivers/irqchip/irq-wpcm450-aic.c
@@ -146,6 +146,7 @@ static int __init wpcm450_aic_of_init(struct device_node *node,
 	aic->regs = of_iomap(node, 0);
 	if (!aic->regs) {
 		pr_err("Failed to map WPCM450 AIC registers\n");
+		kfree(aic);
 		return -ENOMEM;
 	}
 

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

end of thread, other threads:[~2022-11-26 13:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15  9:25 [PATCH v2] irqchip/wpcm450: fix memory leak in wpcm450_aic_of_init() Wei Yongjun
2022-11-15  9:25 ` Wei Yongjun
2022-11-15 16:57 ` Jonathan Neuschäfer
2022-11-15 16:57   ` Jonathan Neuschäfer
2022-11-26 13:34 ` [irqchip: irq/irqchip-next] irqchip/wpcm450: Fix " irqchip-bot for Wei Yongjun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.