All of lore.kernel.org
 help / color / mirror / Atom feed
* [mripard:vc4/rework-helpers 12/28] drivers/clk/clk.c:2385 clk_set_min_rate() warn: variable dereferenced before check 'clk' (see line 2383)
@ 2020-11-16  9:20 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-11-16  9:20 UTC (permalink / raw)
  To: kbuild

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git vc4/rework-helpers
head:   0b08b344d2e1241f8135321b3e0421d95d855bc6
commit: 1f25a431c207a9f4e9024f8285b8a97654e78f39 [12/28] clk: trace: Trace range functions
config: i386-randconfig-m021-20201113 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/clk/clk.c:2385 clk_set_min_rate() warn: variable dereferenced before check 'clk' (see line 2383)

vim +/clk +2385 drivers/clk/clk.c

4dff95dc9477a34 Stephen Boyd  2015-04-30  2381  int clk_set_min_rate(struct clk *clk, unsigned long rate)
035a61c314eb3da Tomeu Vizoso  2015-01-23  2382  {
1f25a431c207a9f Maxime Ripard 2020-10-01 @2383  	trace_clk_set_min_rate(clk->core, rate);
                                                                               ^^^^^^^^^
Derefenced

1f25a431c207a9f Maxime Ripard 2020-10-01  2384  
035a61c314eb3da Tomeu Vizoso  2015-01-23 @2385  	if (!clk)
                                                            ^^^^
Checked too late.

035a61c314eb3da Tomeu Vizoso  2015-01-23  2386  		return 0;
035a61c314eb3da Tomeu Vizoso  2015-01-23  2387  
4dff95dc9477a34 Stephen Boyd  2015-04-30  2388  	return clk_set_rate_range(clk, rate, clk->max_rate);
035a61c314eb3da Tomeu Vizoso  2015-01-23  2389  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 30687 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [mripard:vc4/rework-helpers 12/28] drivers/clk/clk.c:2385 clk_set_min_rate() warn: variable dereferenced before check 'clk' (see line 2383)
@ 2020-11-14 15:15 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-11-14 15:15 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
TO: Maxime Ripard <maxime@cerno.tech>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git vc4/rework-helpers
head:   0b08b344d2e1241f8135321b3e0421d95d855bc6
commit: 1f25a431c207a9f4e9024f8285b8a97654e78f39 [12/28] clk: trace: Trace range functions
:::::: branch date: 2 days ago
:::::: commit date: 4 days ago
config: i386-randconfig-m021-20201113 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/clk/clk.c:2385 clk_set_min_rate() warn: variable dereferenced before check 'clk' (see line 2383)

Old smatch warnings:
drivers/clk/clk.c:3655 clk_hw_create_clk() warn: passing zero to 'ERR_CAST'
drivers/clk/clk.c:3825 __clk_register() warn: passing a valid pointer to 'PTR_ERR'

vim +/clk +2385 drivers/clk/clk.c

035a61c314eb3da Tomeu Vizoso  2015-01-23  2373  
035a61c314eb3da Tomeu Vizoso  2015-01-23  2374  /**
4dff95dc9477a34 Stephen Boyd  2015-04-30  2375   * clk_set_min_rate - set a minimum clock rate for a clock source
4dff95dc9477a34 Stephen Boyd  2015-04-30  2376   * @clk: clock source
4dff95dc9477a34 Stephen Boyd  2015-04-30  2377   * @rate: desired minimum clock rate in Hz, inclusive
035a61c314eb3da Tomeu Vizoso  2015-01-23  2378   *
4dff95dc9477a34 Stephen Boyd  2015-04-30  2379   * Returns success (0) or negative errno.
035a61c314eb3da Tomeu Vizoso  2015-01-23  2380   */
4dff95dc9477a34 Stephen Boyd  2015-04-30  2381  int clk_set_min_rate(struct clk *clk, unsigned long rate)
035a61c314eb3da Tomeu Vizoso  2015-01-23  2382  {
1f25a431c207a9f Maxime Ripard 2020-10-01 @2383  	trace_clk_set_min_rate(clk->core, rate);
1f25a431c207a9f Maxime Ripard 2020-10-01  2384  
035a61c314eb3da Tomeu Vizoso  2015-01-23 @2385  	if (!clk)
035a61c314eb3da Tomeu Vizoso  2015-01-23  2386  		return 0;
035a61c314eb3da Tomeu Vizoso  2015-01-23  2387  
4dff95dc9477a34 Stephen Boyd  2015-04-30  2388  	return clk_set_rate_range(clk, rate, clk->max_rate);
035a61c314eb3da Tomeu Vizoso  2015-01-23  2389  }
4dff95dc9477a34 Stephen Boyd  2015-04-30  2390  EXPORT_SYMBOL_GPL(clk_set_min_rate);
a093bde2b45a0a7 Ulf Hansson   2012-08-31  2391  

:::::: The code at line 2385 was first introduced by commit
:::::: 035a61c314eb3dab5bcc5683afaf4d412689858a clk: Make clk API return per-user struct clk instances

:::::: TO: Tomeu Vizoso <tomeu.vizoso@collabora.com>
:::::: CC: Michael Turquette <mturquette@linaro.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 30687 bytes --]

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

end of thread, other threads:[~2020-11-16  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-16  9:20 [mripard:vc4/rework-helpers 12/28] drivers/clk/clk.c:2385 clk_set_min_rate() warn: variable dereferenced before check 'clk' (see line 2383) Dan Carpenter
2020-11-16  9:20 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-11-14 15:15 kernel test robot

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.