Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1483612

[PATCH 1/4] clk/Renesas-MSTP: Use kmalloc_array() in cpg_mstp_clocks_init()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 1/4] clk/Renesas-MSTP: Use kmalloc_array() in cpg_mstp_clocks_init()
Date 2016-09-14 22:10 +0200
Message-ID <shoFk-5qB-43@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it> <shovD-56t-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 14 Sep 2016 21:10:47 +0200

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/renesas/clk-mstp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
index 5093a25..9375777 100644
--- a/drivers/clk/renesas/clk-mstp.c
+++ b/drivers/clk/renesas/clk-mstp.c
@@ -167,7 +167,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
 	unsigned int i;
 
 	group = kzalloc(sizeof(*group), GFP_KERNEL);
-	clks = kmalloc(MSTP_MAX_CLOCKS * sizeof(*clks), GFP_KERNEL);
+	clks = kmalloc_array(MSTP_MAX_CLOCKS, sizeof(*clks), GFP_KERNEL);
 	if (group == NULL || clks == NULL) {
 		kfree(group);
 		kfree(clks);
-- 
2.10.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] clk/Renesas-MSTP: Fine-tuning for two function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-14 22:00 +0200
  [PATCH 4/4] clk/Renesas-MSTP: Rename jump labels in  cpg_mstp_attach_dev() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-14 22:10 +0200
    Re: [PATCH 4/4] clk/Renesas-MSTP: Rename jump labels in cpg_mstp_attach_dev() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-09-15 21:20 +0200
      Re: clk/Renesas-MSTP: Rename jump labels in cpg_mstp_attach_dev() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-16 08:10 +0200
  [PATCH 1/4] clk/Renesas-MSTP: Use kmalloc_array() in  cpg_mstp_clocks_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-14 22:10 +0200
    Re: [PATCH 1/4] clk/Renesas-MSTP: Use kmalloc_array() in cpg_mstp_clocks_init() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-09-15 21:20 +0200
    Re: [PATCH 1/4] clk/Renesas-MSTP: Use kmalloc_array() in  cpg_mstp_clocks_init() Stephen Boyd <sboyd@codeaurora.org> - 2016-09-17 01:20 +0200
  [PATCH 3/4] clk/Renesas-MSTP: Less function calls in  cpg_mstp_clocks_init() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-14 22:10 +0200
    Re: [PATCH 3/4] clk/Renesas-MSTP: Less function calls in  cpg_mstp_clocks_init() after error detection Geert Uytterhoeven <geert@linux-m68k.org> - 2016-09-15 21:20 +0200
      Re: [PATCH 3/4] clk/Renesas-MSTP: Less function calls in  cpg_mstp_clocks_init() after error detection Geert Uytterhoeven <geert@linux-m68k.org> - 2016-09-15 22:50 +0200
        Re: clk/Renesas-MSTP: Less function calls in cpg_mstp_clocks_init()  after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-16 07:40 +0200
      Re: [PATCH 3/4] clk/Renesas-MSTP: Less function calls in  cpg_mstp_clocks_init() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-15 22:50 +0200
  [PATCH 2/4] clk/Renesas-MSTP: Delete an error message for a failed  memory allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-14 22:10 +0200
    Re: [PATCH 2/4] clk/Renesas-MSTP: Delete an error message for a  failed memory allocation Geert Uytterhoeven <geert@linux-m68k.org> - 2016-09-15 21:10 +0200
      Re: [PATCH 2/4] clk/Renesas-MSTP: Delete an error message for a failed memory allocation Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-09-15 21:20 +0200
        Re: [PATCH 2/4] clk/Renesas-MSTP: Delete an error message for a  failed memory allocation Wolfram Sang <wsa@the-dreams.de> - 2016-09-15 21:50 +0200
        Re: clk/Renesas-MSTP: Delete an error message for a failed memory  allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-15 22:20 +0200
          Re: clk/Renesas-MSTP: Delete an error message for a failed memory allocation Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-09-16 01:00 +0200
            Re: clk/Renesas-MSTP: Delete an error message for a failed memory  allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-16 07:30 +0200

csiph-web