All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: imx: Add check for kcalloc
@ 2022-03-10  8:02 ` Jiasheng Jiang
  0 siblings, 0 replies; 6+ messages in thread
From: Jiasheng Jiang @ 2022-03-10  8:02 UTC (permalink / raw)
  To: abel.vesa, mturquette, sboyd, shawnguo, s.hauer, kernel,
	festevam, linux-imx
  Cc: linux-clk, linux-arm-kernel, linux-kernel, Jiasheng Jiang

As the potential failure of the kcalloc(),
it should be better to check it in order to
avoid the dereference of the NULL pointer.

Fixes: 379c9a24cc23 ("clk: imx: Fix reparenting of UARTs not associated with stdout")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/clk/imx/clk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
index 7cc669934253..99249ab361d2 100644
--- a/drivers/clk/imx/clk.c
+++ b/drivers/clk/imx/clk.c
@@ -173,6 +173,8 @@ void imx_register_uart_clocks(unsigned int clk_count)
 		int i;
 
 		imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
+		if (!imx_uart_clocks)
+			return;
 
 		if (!of_stdout)
 			return;
-- 
2.25.1


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

* [PATCH] clk: imx: Add check for kcalloc
@ 2022-03-10  8:02 ` Jiasheng Jiang
  0 siblings, 0 replies; 6+ messages in thread
From: Jiasheng Jiang @ 2022-03-10  8:02 UTC (permalink / raw)
  To: abel.vesa, mturquette, sboyd, shawnguo, s.hauer, kernel,
	festevam, linux-imx
  Cc: linux-clk, linux-arm-kernel, linux-kernel, Jiasheng Jiang

As the potential failure of the kcalloc(),
it should be better to check it in order to
avoid the dereference of the NULL pointer.

Fixes: 379c9a24cc23 ("clk: imx: Fix reparenting of UARTs not associated with stdout")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/clk/imx/clk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
index 7cc669934253..99249ab361d2 100644
--- a/drivers/clk/imx/clk.c
+++ b/drivers/clk/imx/clk.c
@@ -173,6 +173,8 @@ void imx_register_uart_clocks(unsigned int clk_count)
 		int i;
 
 		imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
+		if (!imx_uart_clocks)
+			return;
 
 		if (!of_stdout)
 			return;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clk: imx: Add check for kcalloc
  2022-03-10  8:02 ` Jiasheng Jiang
@ 2022-04-08 11:49   ` Abel Vesa
  -1 siblings, 0 replies; 6+ messages in thread
From: Abel Vesa @ 2022-04-08 11:49 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	linux-imx, linux-clk, linux-arm-kernel, linux-kernel

On 22-03-10 16:02:57, Jiasheng Jiang wrote:
> As the potential failure of the kcalloc(),
> it should be better to check it in order to
> avoid the dereference of the NULL pointer.
>
> Fixes: 379c9a24cc23 ("clk: imx: Fix reparenting of UARTs not associated with stdout")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Reviewed-by: Abel Vesa <abel.vesa@nxp.com>

> ---
>  drivers/clk/imx/clk.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
> index 7cc669934253..99249ab361d2 100644
> --- a/drivers/clk/imx/clk.c
> +++ b/drivers/clk/imx/clk.c
> @@ -173,6 +173,8 @@ void imx_register_uart_clocks(unsigned int clk_count)
>  		int i;
>
>  		imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
> +		if (!imx_uart_clocks)
> +			return;
>
>  		if (!of_stdout)
>  			return;
> --
> 2.25.1
>

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

* Re: [PATCH] clk: imx: Add check for kcalloc
@ 2022-04-08 11:49   ` Abel Vesa
  0 siblings, 0 replies; 6+ messages in thread
From: Abel Vesa @ 2022-04-08 11:49 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	linux-imx, linux-clk, linux-arm-kernel, linux-kernel

On 22-03-10 16:02:57, Jiasheng Jiang wrote:
> As the potential failure of the kcalloc(),
> it should be better to check it in order to
> avoid the dereference of the NULL pointer.
>
> Fixes: 379c9a24cc23 ("clk: imx: Fix reparenting of UARTs not associated with stdout")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Reviewed-by: Abel Vesa <abel.vesa@nxp.com>

> ---
>  drivers/clk/imx/clk.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
> index 7cc669934253..99249ab361d2 100644
> --- a/drivers/clk/imx/clk.c
> +++ b/drivers/clk/imx/clk.c
> @@ -173,6 +173,8 @@ void imx_register_uart_clocks(unsigned int clk_count)
>  		int i;
>
>  		imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
> +		if (!imx_uart_clocks)
> +			return;
>
>  		if (!of_stdout)
>  			return;
> --
> 2.25.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clk: imx: Add check for kcalloc
  2022-03-10  8:02 ` Jiasheng Jiang
@ 2022-04-12 11:01   ` Abel Vesa
  -1 siblings, 0 replies; 6+ messages in thread
From: Abel Vesa @ 2022-04-12 11:01 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	linux-imx, linux-clk, linux-arm-kernel, linux-kernel

On 22-03-10 16:02:57, Jiasheng Jiang wrote:
> As the potential failure of the kcalloc(),
> it should be better to check it in order to
> avoid the dereference of the NULL pointer.
>
> Fixes: 379c9a24cc23 ("clk: imx: Fix reparenting of UARTs not associated with stdout")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Applied, thanks!

> ---
>  drivers/clk/imx/clk.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
> index 7cc669934253..99249ab361d2 100644
> --- a/drivers/clk/imx/clk.c
> +++ b/drivers/clk/imx/clk.c
> @@ -173,6 +173,8 @@ void imx_register_uart_clocks(unsigned int clk_count)
>  		int i;
>
>  		imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
> +		if (!imx_uart_clocks)
> +			return;
>
>  		if (!of_stdout)
>  			return;
> --
> 2.25.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clk: imx: Add check for kcalloc
@ 2022-04-12 11:01   ` Abel Vesa
  0 siblings, 0 replies; 6+ messages in thread
From: Abel Vesa @ 2022-04-12 11:01 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	linux-imx, linux-clk, linux-arm-kernel, linux-kernel

On 22-03-10 16:02:57, Jiasheng Jiang wrote:
> As the potential failure of the kcalloc(),
> it should be better to check it in order to
> avoid the dereference of the NULL pointer.
>
> Fixes: 379c9a24cc23 ("clk: imx: Fix reparenting of UARTs not associated with stdout")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Applied, thanks!

> ---
>  drivers/clk/imx/clk.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
> index 7cc669934253..99249ab361d2 100644
> --- a/drivers/clk/imx/clk.c
> +++ b/drivers/clk/imx/clk.c
> @@ -173,6 +173,8 @@ void imx_register_uart_clocks(unsigned int clk_count)
>  		int i;
>
>  		imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
> +		if (!imx_uart_clocks)
> +			return;
>
>  		if (!of_stdout)
>  			return;
> --
> 2.25.1
>

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

end of thread, other threads:[~2022-04-12 12:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10  8:02 [PATCH] clk: imx: Add check for kcalloc Jiasheng Jiang
2022-03-10  8:02 ` Jiasheng Jiang
2022-04-08 11:49 ` Abel Vesa
2022-04-08 11:49   ` Abel Vesa
2022-04-12 11:01 ` Abel Vesa
2022-04-12 11:01   ` Abel Vesa

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.