All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)
@ 2022-10-27  7:36 Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-10-27  7:36 UTC (permalink / raw)
  To: kbuild, Alvin Lee; +Cc: lkp, kbuild-all, linux-kernel, Alex Deucher, Samson Tam

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4dc12f37a8e98e1dca5521c14625c869537b50b6
commit: a141d2083b462505727e14d98db5fc3cd43d59c6 drm/amd/display: Add debug option for exiting idle optimizations on cursor updates
config: mips-randconfig-m031-20221018
compiler: mips64el-linux-gcc (GCC) 12.1.0

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

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)

vim +/stream +395 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c

ab2541b6739508 Aric Cyr            2016-12-29  388  bool dc_stream_set_cursor_position(
0971c40e180696 Harry Wentland      2017-07-27  389  	struct dc_stream_state *stream,
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  390  	const struct dc_cursor_position *position)
ab2541b6739508 Aric Cyr            2016-12-29  391  {
a141d2083b4625 Alvin Lee           2022-06-03 @392  	struct dc  *dc = stream->ctx->dc;
                                                                         ^^^^^^^^^^^^^^^^
New unchecked dereference

4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  393  	bool reset_idle_optimizations = false;
ab2541b6739508 Aric Cyr            2016-12-29  394  
4fa086b9b66408 Leo (Sunpeng  Li    2017-07-25 @395) 	if (NULL == stream) {
                                                            ^^^^^^^^^^^^^^
Old Yoda code check for NULL

ab2541b6739508 Aric Cyr            2016-12-29  396  		dm_error("DC: dc_stream is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  397  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  398  	}
ab2541b6739508 Aric Cyr            2016-12-29  399  
ab2541b6739508 Aric Cyr            2016-12-29  400  	if (NULL == position) {
ab2541b6739508 Aric Cyr            2016-12-29  401  		dm_error("DC: cursor position is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  402  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  403  	}
ab2541b6739508 Aric Cyr            2016-12-29  404  
2b77dcc5e5aa38 Anthony Koo         2019-11-05  405  	dc = stream->ctx->dc;
bae1f0b8a5b189 Nicholas Kazlauskas 2021-05-19  406  	dc_z10_restore(dc);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  407  
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  408  	/* disable idle optimizations if enabling cursor */
a141d2083b4625 Alvin Lee           2022-06-03  409  	if (dc->idle_optimizations_allowed && (!stream->cursor_position.enable || dc->debug.exit_idle_opt_for_cursor_updates)
a141d2083b4625 Alvin Lee           2022-06-03  410  			&& position->enable) {
4b675aad969507 Joshua Aberback     2020-08-31  411  		dc_allow_idle_optimizations(dc, false);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  412  		reset_idle_optimizations = true;
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  413  	}
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  414  
33fd17d9125c00 Eric Yang           2018-01-18  415  	stream->cursor_position = *position;
ab2541b6739508 Aric Cyr            2016-12-29  416  
4fd771ea441ed9 Roy Chan            2021-07-19  417  	program_cursor_position(dc, stream, position);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  418  	/* re-enable idle optimizations if necessary */
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  419  	if (reset_idle_optimizations)
4b675aad969507 Joshua Aberback     2020-08-31  420  		dc_allow_idle_optimizations(dc, true);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  421  
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  422  	return true;
ab2541b6739508 Aric Cyr            2016-12-29  423  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


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

* drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)
@ 2022-08-25  7:12 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2022-08-25  7:12 UTC (permalink / raw)
  To: kbuild

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

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Alvin Lee <Alvin.Lee2@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Samson Tam <Samson.Tam@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c40e8341e3b3bb27e3a65b06b5b454626234c4f0
commit: a141d2083b462505727e14d98db5fc3cd43d59c6 drm/amd/display: Add debug option for exiting idle optimizations on cursor updates
date:   2 months ago
:::::: branch date: 28 hours ago
:::::: commit date: 2 months ago
config: microblaze-randconfig-m041-20220824 (https://download.01.org/0day-ci/archive/20220825/202208251541.ZM8oLNUg-lkp(a)intel.com/config)
compiler: microblaze-linux-gcc (GCC) 12.1.0

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

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)

vim +/stream +395 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c

ab2541b6739508 Aric Cyr            2016-12-29  387  
ab2541b6739508 Aric Cyr            2016-12-29  388  bool dc_stream_set_cursor_position(
0971c40e180696 Harry Wentland      2017-07-27  389  	struct dc_stream_state *stream,
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  390  	const struct dc_cursor_position *position)
ab2541b6739508 Aric Cyr            2016-12-29  391  {
a141d2083b4625 Alvin Lee           2022-06-03 @392  	struct dc  *dc = stream->ctx->dc;
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  393  	bool reset_idle_optimizations = false;
ab2541b6739508 Aric Cyr            2016-12-29  394  
4fa086b9b66408 Leo (Sunpeng  Li    2017-07-25 @395) 	if (NULL == stream) {
ab2541b6739508 Aric Cyr            2016-12-29  396  		dm_error("DC: dc_stream is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  397  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  398  	}
ab2541b6739508 Aric Cyr            2016-12-29  399  
ab2541b6739508 Aric Cyr            2016-12-29  400  	if (NULL == position) {
ab2541b6739508 Aric Cyr            2016-12-29  401  		dm_error("DC: cursor position is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  402  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  403  	}
ab2541b6739508 Aric Cyr            2016-12-29  404  
2b77dcc5e5aa38 Anthony Koo         2019-11-05  405  	dc = stream->ctx->dc;
bae1f0b8a5b189 Nicholas Kazlauskas 2021-05-19  406  	dc_z10_restore(dc);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  407  
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  408  	/* disable idle optimizations if enabling cursor */
a141d2083b4625 Alvin Lee           2022-06-03  409  	if (dc->idle_optimizations_allowed && (!stream->cursor_position.enable || dc->debug.exit_idle_opt_for_cursor_updates)
a141d2083b4625 Alvin Lee           2022-06-03  410  			&& position->enable) {
4b675aad969507 Joshua Aberback     2020-08-31  411  		dc_allow_idle_optimizations(dc, false);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  412  		reset_idle_optimizations = true;
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  413  	}
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  414  
33fd17d9125c00 Eric Yang           2018-01-18  415  	stream->cursor_position = *position;
ab2541b6739508 Aric Cyr            2016-12-29  416  
4fd771ea441ed9 Roy Chan            2021-07-19  417  	program_cursor_position(dc, stream, position);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  418  	/* re-enable idle optimizations if necessary */
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  419  	if (reset_idle_optimizations)
4b675aad969507 Joshua Aberback     2020-08-31  420  		dc_allow_idle_optimizations(dc, true);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  421  
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  422  	return true;
ab2541b6739508 Aric Cyr            2016-12-29  423  }
ab2541b6739508 Aric Cyr            2016-12-29  424  

:::::: The code at line 395 was first introduced by commit
:::::: 4fa086b9b6640818c053c79d4d7104790ba76cb7 drm/amd/display: Roll core_stream into dc_stream

:::::: TO: Leo (Sunpeng) Li <sunpeng.li@amd.com>
:::::: CC: Alex Deucher <alexander.deucher@amd.com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)
@ 2022-08-19  3:30 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2022-08-19  3:30 UTC (permalink / raw)
  To: kbuild

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

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Alvin Lee <Alvin.Lee2@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Samson Tam <Samson.Tam@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   573ae4f13f630d6660008f1974c0a8a29c30e18a
commit: a141d2083b462505727e14d98db5fc3cd43d59c6 drm/amd/display: Add debug option for exiting idle optimizations on cursor updates
date:   9 weeks ago
:::::: branch date: 11 hours ago
:::::: commit date: 9 weeks ago
config: ia64-randconfig-m031-20220814 (https://download.01.org/0day-ci/archive/20220819/202208191140.kke5bXbX-lkp(a)intel.com/config)
compiler: ia64-linux-gcc (GCC) 12.1.0

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

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)

vim +/stream +395 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c

ab2541b6739508 Aric Cyr            2016-12-29  387  
ab2541b6739508 Aric Cyr            2016-12-29  388  bool dc_stream_set_cursor_position(
0971c40e180696 Harry Wentland      2017-07-27  389  	struct dc_stream_state *stream,
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  390  	const struct dc_cursor_position *position)
ab2541b6739508 Aric Cyr            2016-12-29  391  {
a141d2083b4625 Alvin Lee           2022-06-03 @392  	struct dc  *dc = stream->ctx->dc;
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  393  	bool reset_idle_optimizations = false;
ab2541b6739508 Aric Cyr            2016-12-29  394  
4fa086b9b66408 Leo (Sunpeng  Li    2017-07-25 @395) 	if (NULL == stream) {
ab2541b6739508 Aric Cyr            2016-12-29  396  		dm_error("DC: dc_stream is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  397  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  398  	}
ab2541b6739508 Aric Cyr            2016-12-29  399  
ab2541b6739508 Aric Cyr            2016-12-29  400  	if (NULL == position) {
ab2541b6739508 Aric Cyr            2016-12-29  401  		dm_error("DC: cursor position is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  402  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  403  	}
ab2541b6739508 Aric Cyr            2016-12-29  404  
2b77dcc5e5aa38 Anthony Koo         2019-11-05  405  	dc = stream->ctx->dc;
bae1f0b8a5b189 Nicholas Kazlauskas 2021-05-19  406  	dc_z10_restore(dc);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  407  
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  408  	/* disable idle optimizations if enabling cursor */
a141d2083b4625 Alvin Lee           2022-06-03  409  	if (dc->idle_optimizations_allowed && (!stream->cursor_position.enable || dc->debug.exit_idle_opt_for_cursor_updates)
a141d2083b4625 Alvin Lee           2022-06-03  410  			&& position->enable) {
4b675aad969507 Joshua Aberback     2020-08-31  411  		dc_allow_idle_optimizations(dc, false);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  412  		reset_idle_optimizations = true;
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  413  	}
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  414  
33fd17d9125c00 Eric Yang           2018-01-18  415  	stream->cursor_position = *position;
ab2541b6739508 Aric Cyr            2016-12-29  416  
4fd771ea441ed9 Roy Chan            2021-07-19  417  	program_cursor_position(dc, stream, position);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  418  	/* re-enable idle optimizations if necessary */
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  419  	if (reset_idle_optimizations)
4b675aad969507 Joshua Aberback     2020-08-31  420  		dc_allow_idle_optimizations(dc, true);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  421  
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  422  	return true;
ab2541b6739508 Aric Cyr            2016-12-29  423  }
ab2541b6739508 Aric Cyr            2016-12-29  424  

:::::: The code at line 395 was first introduced by commit
:::::: 4fa086b9b6640818c053c79d4d7104790ba76cb7 drm/amd/display: Roll core_stream into dc_stream

:::::: TO: Leo (Sunpeng) Li <sunpeng.li@amd.com>
:::::: CC: Alex Deucher <alexander.deucher@amd.com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)
@ 2022-08-18 11:05 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-08-18 11:05 UTC (permalink / raw)
  To: kbuild, Alvin Lee; +Cc: lkp, kbuild-all, linux-kernel, Alex Deucher, Samson Tam

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3cc40a443a04d52b0c95255dce264068b01e9bfe
commit: a141d2083b462505727e14d98db5fc3cd43d59c6 drm/amd/display: Add debug option for exiting idle optimizations on cursor updates
config: ia64-randconfig-m031-20220814 (https://download.01.org/0day-ci/archive/20220817/202208171701.gFan3WQE-lkp@intel.com/config)
compiler: ia64-linux-gcc (GCC) 12.1.0

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

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)

vim +/stream +395 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c

ab2541b6739508 Aric Cyr            2016-12-29  388  bool dc_stream_set_cursor_position(
0971c40e180696 Harry Wentland      2017-07-27  389  	struct dc_stream_state *stream,
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  390  	const struct dc_cursor_position *position)
ab2541b6739508 Aric Cyr            2016-12-29  391  {
a141d2083b4625 Alvin Lee           2022-06-03 @392  	struct dc  *dc = stream->ctx->dc;
                                                                         ^^^^^^^^^^^
Dereference

4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  393  	bool reset_idle_optimizations = false;
ab2541b6739508 Aric Cyr            2016-12-29  394  
4fa086b9b66408 Leo (Sunpeng  Li    2017-07-25 @395) 	if (NULL == stream) {
                                                            ^^^^^^^^^^^^^^^
NULL check too late.  Presumably it can be deleted.

ab2541b6739508 Aric Cyr            2016-12-29  396  		dm_error("DC: dc_stream is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  397  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  398  	}
ab2541b6739508 Aric Cyr            2016-12-29  399  
ab2541b6739508 Aric Cyr            2016-12-29  400  	if (NULL == position) {
ab2541b6739508 Aric Cyr            2016-12-29  401  		dm_error("DC: cursor position is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  402  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  403  	}
ab2541b6739508 Aric Cyr            2016-12-29  404  
2b77dcc5e5aa38 Anthony Koo         2019-11-05  405  	dc = stream->ctx->dc;
bae1f0b8a5b189 Nicholas Kazlauskas 2021-05-19  406  	dc_z10_restore(dc);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  407  
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  408  	/* disable idle optimizations if enabling cursor */
a141d2083b4625 Alvin Lee           2022-06-03  409  	if (dc->idle_optimizations_allowed && (!stream->cursor_position.enable || dc->debug.exit_idle_opt_for_cursor_updates)
a141d2083b4625 Alvin Lee           2022-06-03  410  			&& position->enable) {
4b675aad969507 Joshua Aberback     2020-08-31  411  		dc_allow_idle_optimizations(dc, false);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  412  		reset_idle_optimizations = true;
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  413  	}
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  414  
33fd17d9125c00 Eric Yang           2018-01-18  415  	stream->cursor_position = *position;
ab2541b6739508 Aric Cyr            2016-12-29  416  
4fd771ea441ed9 Roy Chan            2021-07-19  417  	program_cursor_position(dc, stream, position);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  418  	/* re-enable idle optimizations if necessary */
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  419  	if (reset_idle_optimizations)
4b675aad969507 Joshua Aberback     2020-08-31  420  		dc_allow_idle_optimizations(dc, true);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  421  
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  422  	return true;
ab2541b6739508 Aric Cyr            2016-12-29  423  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


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

* drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)
@ 2022-08-18 11:05 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-08-18 11:05 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3cc40a443a04d52b0c95255dce264068b01e9bfe
commit: a141d2083b462505727e14d98db5fc3cd43d59c6 drm/amd/display: Add debug option for exiting idle optimizations on cursor updates
config: ia64-randconfig-m031-20220814 (https://download.01.org/0day-ci/archive/20220817/202208171701.gFan3WQE-lkp(a)intel.com/config)
compiler: ia64-linux-gcc (GCC) 12.1.0

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

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)

vim +/stream +395 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c

ab2541b6739508 Aric Cyr            2016-12-29  388  bool dc_stream_set_cursor_position(
0971c40e180696 Harry Wentland      2017-07-27  389  	struct dc_stream_state *stream,
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  390  	const struct dc_cursor_position *position)
ab2541b6739508 Aric Cyr            2016-12-29  391  {
a141d2083b4625 Alvin Lee           2022-06-03 @392  	struct dc  *dc = stream->ctx->dc;
                                                                         ^^^^^^^^^^^
Dereference

4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  393  	bool reset_idle_optimizations = false;
ab2541b6739508 Aric Cyr            2016-12-29  394  
4fa086b9b66408 Leo (Sunpeng  Li    2017-07-25 @395) 	if (NULL == stream) {
                                                            ^^^^^^^^^^^^^^^
NULL check too late.  Presumably it can be deleted.

ab2541b6739508 Aric Cyr            2016-12-29  396  		dm_error("DC: dc_stream is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  397  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  398  	}
ab2541b6739508 Aric Cyr            2016-12-29  399  
ab2541b6739508 Aric Cyr            2016-12-29  400  	if (NULL == position) {
ab2541b6739508 Aric Cyr            2016-12-29  401  		dm_error("DC: cursor position is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  402  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  403  	}
ab2541b6739508 Aric Cyr            2016-12-29  404  
2b77dcc5e5aa38 Anthony Koo         2019-11-05  405  	dc = stream->ctx->dc;
bae1f0b8a5b189 Nicholas Kazlauskas 2021-05-19  406  	dc_z10_restore(dc);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  407  
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  408  	/* disable idle optimizations if enabling cursor */
a141d2083b4625 Alvin Lee           2022-06-03  409  	if (dc->idle_optimizations_allowed && (!stream->cursor_position.enable || dc->debug.exit_idle_opt_for_cursor_updates)
a141d2083b4625 Alvin Lee           2022-06-03  410  			&& position->enable) {
4b675aad969507 Joshua Aberback     2020-08-31  411  		dc_allow_idle_optimizations(dc, false);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  412  		reset_idle_optimizations = true;
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  413  	}
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  414  
33fd17d9125c00 Eric Yang           2018-01-18  415  	stream->cursor_position = *position;
ab2541b6739508 Aric Cyr            2016-12-29  416  
4fd771ea441ed9 Roy Chan            2021-07-19  417  	program_cursor_position(dc, stream, position);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  418  	/* re-enable idle optimizations if necessary */
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  419  	if (reset_idle_optimizations)
4b675aad969507 Joshua Aberback     2020-08-31  420  		dc_allow_idle_optimizations(dc, true);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  421  
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  422  	return true;
ab2541b6739508 Aric Cyr            2016-12-29  423  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)
@ 2022-08-18 11:05 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2022-08-17  9:15 UTC (permalink / raw)
  To: kbuild

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

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Alvin Lee <Alvin.Lee2@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Samson Tam <Samson.Tam@amd.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3cc40a443a04d52b0c95255dce264068b01e9bfe
commit: a141d2083b462505727e14d98db5fc3cd43d59c6 drm/amd/display: Add debug option for exiting idle optimizations on cursor updates
date:   9 weeks ago
:::::: branch date: 14 hours ago
:::::: commit date: 9 weeks ago
config: ia64-randconfig-m031-20220814 (https://download.01.org/0day-ci/archive/20220817/202208171701.gFan3WQE-lkp(a)intel.com/config)
compiler: ia64-linux-gcc (GCC) 12.1.0

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

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)

vim +/stream +395 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c

ab2541b6739508 Aric Cyr            2016-12-29  387  
ab2541b6739508 Aric Cyr            2016-12-29  388  bool dc_stream_set_cursor_position(
0971c40e180696 Harry Wentland      2017-07-27  389  	struct dc_stream_state *stream,
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  390  	const struct dc_cursor_position *position)
ab2541b6739508 Aric Cyr            2016-12-29  391  {
a141d2083b4625 Alvin Lee           2022-06-03 @392  	struct dc  *dc = stream->ctx->dc;
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  393  	bool reset_idle_optimizations = false;
ab2541b6739508 Aric Cyr            2016-12-29  394  
4fa086b9b66408 Leo (Sunpeng  Li    2017-07-25 @395) 	if (NULL == stream) {
ab2541b6739508 Aric Cyr            2016-12-29  396  		dm_error("DC: dc_stream is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  397  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  398  	}
ab2541b6739508 Aric Cyr            2016-12-29  399  
ab2541b6739508 Aric Cyr            2016-12-29  400  	if (NULL == position) {
ab2541b6739508 Aric Cyr            2016-12-29  401  		dm_error("DC: cursor position is NULL!\n");
ab2541b6739508 Aric Cyr            2016-12-29  402  		return false;
ab2541b6739508 Aric Cyr            2016-12-29  403  	}
ab2541b6739508 Aric Cyr            2016-12-29  404  
2b77dcc5e5aa38 Anthony Koo         2019-11-05  405  	dc = stream->ctx->dc;
bae1f0b8a5b189 Nicholas Kazlauskas 2021-05-19  406  	dc_z10_restore(dc);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  407  
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  408  	/* disable idle optimizations if enabling cursor */
a141d2083b4625 Alvin Lee           2022-06-03  409  	if (dc->idle_optimizations_allowed && (!stream->cursor_position.enable || dc->debug.exit_idle_opt_for_cursor_updates)
a141d2083b4625 Alvin Lee           2022-06-03  410  			&& position->enable) {
4b675aad969507 Joshua Aberback     2020-08-31  411  		dc_allow_idle_optimizations(dc, false);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  412  		reset_idle_optimizations = true;
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  413  	}
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  414  
33fd17d9125c00 Eric Yang           2018-01-18  415  	stream->cursor_position = *position;
ab2541b6739508 Aric Cyr            2016-12-29  416  
4fd771ea441ed9 Roy Chan            2021-07-19  417  	program_cursor_position(dc, stream, position);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  418  	/* re-enable idle optimizations if necessary */
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  419  	if (reset_idle_optimizations)
4b675aad969507 Joshua Aberback     2020-08-31  420  		dc_allow_idle_optimizations(dc, true);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  421  
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  422  	return true;
ab2541b6739508 Aric Cyr            2016-12-29  423  }
ab2541b6739508 Aric Cyr            2016-12-29  424  

:::::: The code at line 395 was first introduced by commit
:::::: 4fa086b9b6640818c053c79d4d7104790ba76cb7 drm/amd/display: Roll core_stream into dc_stream

:::::: TO: Leo (Sunpeng) Li <sunpeng.li@amd.com>
:::::: CC: Alex Deucher <alexander.deucher@amd.com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

end of thread, other threads:[~2022-10-27  7:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27  7:36 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392) Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2022-08-25  7:12 kernel test robot
2022-08-19  3:30 kernel test robot
2022-08-18 11:05 Dan Carpenter
2022-08-17  9:15 ` kernel test robot
2022-08-18 11:05 ` Dan Carpenter

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.