Linux clock framework development
 help / color / mirror / Atom feed
* [PATCH] clk: keystone: sci-clk: fix application of sizeof to pointer
@ 2026-05-08 15:23 Nishanth Menon
  2026-05-08 16:59 ` Andrew Davis
  2026-05-09 11:34 ` Stepan Ionichev
  0 siblings, 2 replies; 8+ messages in thread
From: Nishanth Menon @ 2026-05-08 15:23 UTC (permalink / raw)
  To: Brian Masney, Stephen Boyd, Michael Turquette, Santosh Shilimkar,
	Tero Kristo, Nishanth Menon
  Cc: linux-clk, linux-kernel, linux-arm-kernel, Jing Yangyang,
	Zeal Robot, kernel test robot, Julia Lawall, David Yang,
	Jing Yangyang, Ran Sun

From: Jing Yangyang <jing.yangyang@zte.com.cn>

Coccinelle (scripts/coccinelle/misc/noderef.cocci) reports:

  drivers/clk/keystone/sci-clk.c:391:8-14: ERROR: application of
  sizeof to pointer

provider->clocks is an array of struct sci_clk *, so bsearch()
expects the size of each element (struct sci_clk *). However,
sizeof(clk) evaluates to the size of a pointer-to-pointer.

Use sizeof(*clk) to pass the correct element size.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Closes: https://lore.kernel.org/all/84a6ba16686347099a3dab2e5161a930e792eb6e.1629198281.git.jing.yangyang@zte.com.cn/
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@inria.fr>
Closes: https://lore.kernel.org/all/202512040525.zrHSDl5h-lkp@intel.com/
Link: https://lore.kernel.org/linux-clk/20211012021931.176727-1-davidcomponentone@gmail.com/
Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
[nm@ti.com: Improved commit message]
Signed-off-by: Nishanth Menon <nm@ti.com>
---
Cc: Jing Yangyang <cgel.zte@gmail.com>
Cc: Ran Sun <sunran001@208suo.com>

 - Functionality: No impact (on Linux architectures), thus no Fixes/Stable tag.
 - History: This patch has long-standing history; I have attributed it to the
  earliest valid author found during a recent scrub.
 - Reports: Retained chronological attribution even where public reports (Zeal
  Robot) are unavailable.
 - Checkpatch: Acknowledging minor warning regarding tag ordering (Reported-by
  / Closes sequence); chosen to maintain link integrity for automated tools.
 - Testing: Verified on available K3 SoCs against 2026-05-07:
  https://gist.github.com/nmenon/afa9ac915e189334f048c177f16fe54f

 drivers/clk/keystone/sci-clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index 9d5071223f4c..2fc1f050779b 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -388,7 +388,7 @@ static struct clk_hw *sci_clk_get(struct of_phandle_args *clkspec, void *data)
 	key.clk_id = clkspec->args[1];
 
 	clk = bsearch(&key, provider->clocks, provider->num_clocks,
-		      sizeof(clk), _cmp_sci_clk);
+		      sizeof(*clk), _cmp_sci_clk);
 
 	if (!clk)
 		return ERR_PTR(-ENODEV);
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread
[parent not found: <20230721011303.4303-1-xujianghui@cdjrlc.com>]
[parent not found: <20230720074906.3373-1-xujianghui@cdjrlc.com>]

end of thread, other threads:[~2026-05-09 18:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08 15:23 [PATCH] clk: keystone: sci-clk: fix application of sizeof to pointer Nishanth Menon
2026-05-08 16:59 ` Andrew Davis
2026-05-08 17:07   ` Nishanth Menon
2026-05-09 11:34 ` Stepan Ionichev
     [not found] <20230721011303.4303-1-xujianghui@cdjrlc.com>
2023-07-21  1:14 ` sunran001
2023-08-22 23:01   ` Stephen Boyd
     [not found] <20230720074906.3373-1-xujianghui@cdjrlc.com>
2023-07-20  8:42 ` sunran001
2023-07-20 13:55   ` Nishanth Menon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox