drivers/gpu/drm/armada/armada_plane.c:124 armada_drm_plane_atomic_check() warn: variable dereferenced before check 'state' (see line 111)
From: Dan Carpenter
Date: Tue Jan 18 2022 - 10:20:13 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 79e06c4c4950be2abd8ca5d2428a8c915aa62c24
commit: dec92020671c48da231189eb06a5f755f492f87f drm: Use the state pointer directly in planes atomic_check
config: arm-randconfig-m031-20220116 (https://download.01.org/0day-ci/archive/20220117/202201170744.uress2oV-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.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/armada/armada_plane.c:124 armada_drm_plane_atomic_check() warn: variable dereferenced before check 'state' (see line 111)
vim +/state +124 drivers/gpu/drm/armada/armada_plane.c
d40af7b1ae23da Russell King 2018-07-30 108 int armada_drm_plane_atomic_check(struct drm_plane *plane,
7c11b99a8e58c0 Maxime Ripard 2021-02-19 109 struct drm_atomic_state *state)
d40af7b1ae23da Russell King 2018-07-30 110 {
7c11b99a8e58c0 Maxime Ripard 2021-02-19 @111 struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
^^^^^^
Dereference
7c11b99a8e58c0 Maxime Ripard 2021-02-19 112 plane);
ba5c1649465d40 Maxime Ripard 2021-02-19 113 struct armada_plane_state *st = to_armada_plane_state(new_plane_state);
ba5c1649465d40 Maxime Ripard 2021-02-19 114 struct drm_crtc *crtc = new_plane_state->crtc;
d40af7b1ae23da Russell King 2018-07-30 115 struct drm_crtc_state *crtc_state;
1d1547ec12bc7d Russell King 2019-01-25 116 bool interlace;
1d1547ec12bc7d Russell King 2019-01-25 117 int ret;
1d1547ec12bc7d Russell King 2019-01-25 118
ba5c1649465d40 Maxime Ripard 2021-02-19 119 if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc)) {
ba5c1649465d40 Maxime Ripard 2021-02-19 120 new_plane_state->visible = false;
1d1547ec12bc7d Russell King 2019-01-25 121 return 0;
1d1547ec12bc7d Russell King 2019-01-25 122 }
d40af7b1ae23da Russell King 2018-07-30 123
dec92020671c48 Maxime Ripard 2021-02-19 @124 if (state)
^^^^^
Checked too late
dec92020671c48 Maxime Ripard 2021-02-19 125 crtc_state = drm_atomic_get_existing_crtc_state(state,
ba5c1649465d40 Maxime Ripard 2021-02-19 126 crtc);
d40af7b1ae23da Russell King 2018-07-30 127 else
d40af7b1ae23da Russell King 2018-07-30 128 crtc_state = crtc->state;
1d1547ec12bc7d Russell King 2019-01-25 129
ba5c1649465d40 Maxime Ripard 2021-02-19 130 ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
ba5c1649465d40 Maxime Ripard 2021-02-19 131 0,
1d1547ec12bc7d Russell King 2019-01-25 132 INT_MAX, true, false);
1d1547ec12bc7d Russell King 2019-01-25 133 if (ret)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx