Re: [PATCH 4/5] Critical-KlockWork-Fix-intel_tv.c-Possible-Null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nischal,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Nischal-Varide/Critical-KclockWork-Fixes-intel_atomi-c-PossibleNull/20200819-193249
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-m021-20200824 (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@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/gpu/drm/i915/display/intel_tv.c:1842 intel_tv_atomic_check() warn: variable dereferenced before check 'new_state' (see line 1840)

# https://github.com/0day-ci/linux/commit/6fb528c1b424d3c8095085afa7e777ac5502450b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nischal-Varide/Critical-KclockWork-Fixes-intel_atomi-c-PossibleNull/20200819-193249
git checkout 6fb528c1b424d3c8095085afa7e777ac5502450b
vim +/new_state +1842 drivers/gpu/drm/i915/display/intel_tv.c

0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1831  static int intel_tv_atomic_check(struct drm_connector *connector,
6f3b62781bbd26 drivers/gpu/drm/i915/intel_tv.c         Sean Paul         2019-06-11  1832  				 struct drm_atomic_state *state)
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1833  {
6f3b62781bbd26 drivers/gpu/drm/i915/intel_tv.c         Sean Paul         2019-06-11  1834  	struct drm_connector_state *new_state;
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1835  	struct drm_crtc_state *new_crtc_state;
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1836  	struct drm_connector_state *old_state;
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1837  
6f3b62781bbd26 drivers/gpu/drm/i915/intel_tv.c         Sean Paul         2019-06-11  1838  	new_state = drm_atomic_get_new_connector_state(state, connector);
6f3b62781bbd26 drivers/gpu/drm/i915/intel_tv.c         Sean Paul         2019-06-11  1839  	old_state = drm_atomic_get_old_connector_state(state, connector);
6f3b62781bbd26 drivers/gpu/drm/i915/intel_tv.c         Sean Paul         2019-06-11 @1840  	new_crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc);
                                                                                                                                                      ^^^^^^^^^^^^^^^
Dereference

0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1841  
6fb528c1b424d3 drivers/gpu/drm/i915/display/intel_tv.c Nischal Varide    2020-08-19 @1842  	if (!(old_state && new_state && new_crtc_state))
                                                                                                                   ^^^^^^^^^
Checked too late

6fb528c1b424d3 drivers/gpu/drm/i915/display/intel_tv.c Nischal Varide    2020-08-19  1843  		return 0;
6fb528c1b424d3 drivers/gpu/drm/i915/display/intel_tv.c Nischal Varide    2020-08-19  1844  
6fb528c1b424d3 drivers/gpu/drm/i915/display/intel_tv.c Nischal Varide    2020-08-19  1845  	if (!new_state->crtc)
6fb528c1b424d3 drivers/gpu/drm/i915/display/intel_tv.c Nischal Varide    2020-08-19  1846  		return 0;
6fb528c1b424d3 drivers/gpu/drm/i915/display/intel_tv.c Nischal Varide    2020-08-19  1847  
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1848  	if (old_state->tv.mode != new_state->tv.mode ||
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1849  		old_state->tv.margins.left != new_state->tv.margins.left ||
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1850  		old_state->tv.margins.right != new_state->tv.margins.right ||
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1851  		old_state->tv.margins.top != new_state->tv.margins.top ||
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1852  		old_state->tv.margins.bottom != new_state->tv.margins.bottom) {
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1853  		/* Force a modeset. */
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1854  
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1855  		new_crtc_state->connectors_changed = true;
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1856  	}
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1857  
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1858  	return 0;
0e891b3f447f4d drivers/gpu/drm/i915/intel_tv.c         Maarten Lankhorst 2017-04-10  1859  }

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux