lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202206191752.JhkxXCi7-lkp@intel.com>
Date:   Mon, 20 Jun 2022 11:55:37 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Sung Joon Kim <Sungjoon.Kim@....com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Alex Deucher <alexander.deucher@....com>,
        Melissa Wen <mwen@...lia.com>
Subject: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5412
 fill_blending_from_plane_state() warn: variable dereferenced before check
 'per_pixel_alpha' (see line 5387)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4b35035bcf80ddb47c0112c4fbd84a63a2836a18
commit: 76818cdd11a25ac6cb1d98875719935d8d0e2e51 drm/amd/display: add Coverage blend mode for overlay plane
config: ia64-randconfig-m031-20220616 (https://download.01.org/0day-ci/archive/20220619/202206191752.JhkxXCi7-lkp@intel.com/config)
compiler: ia64-linux-gcc (GCC) 11.3.0

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

New smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5412 fill_blending_from_plane_state() warn: variable dereferenced before check 'per_pixel_alpha' (see line 5387)

Old smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1726 amdgpu_dm_fini() warn: variable dereferenced before check 'adev->dm.dc' (see line 1699)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2707 dm_resume() error: we previously assumed 'aconnector->dc_link' could be null (see line 2694)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3995 amdgpu_dm_backlight_update_status() error: testing array offset 'i' after use.
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4037 amdgpu_dm_backlight_get_brightness() error: testing array offset 'i' after use.
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:6507 create_stream_for_sink() error: we previously assumed 'aconnector->dc_sink' could be null (see line 6406)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8894 handle_cursor_update() error: we previously assumed 'afb' could be null (see line 8853)

vim +/per_pixel_alpha +5412 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c

d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5382  static void
695af5f9a51914 Nicholas Kazlauskas 2019-03-28  5383  fill_blending_from_plane_state(const struct drm_plane_state *plane_state,
76818cdd11a25a Sung Joon Kim       2022-05-19  5384  			       bool *per_pixel_alpha, bool *pre_multiplied_alpha,
76818cdd11a25a Sung Joon Kim       2022-05-19  5385  			       bool *global_alpha, int *global_alpha_value)
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5386  {
d74004b694ea88 Nicholas Kazlauskas 2019-02-21 @5387  	*per_pixel_alpha = false;

Dereference

76818cdd11a25a Sung Joon Kim       2022-05-19  5388  	*pre_multiplied_alpha = true;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5389  	*global_alpha = false;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5390  	*global_alpha_value = 0xff;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5391  
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5392  	if (plane_state->plane->type != DRM_PLANE_TYPE_OVERLAY)
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5393  		return;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5394  
76818cdd11a25a Sung Joon Kim       2022-05-19  5395  	if (plane_state->pixel_blend_mode == DRM_MODE_BLEND_PREMULTI ||
76818cdd11a25a Sung Joon Kim       2022-05-19  5396  		plane_state->pixel_blend_mode == DRM_MODE_BLEND_COVERAGE) {
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5397  		static const uint32_t alpha_formats[] = {
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5398  			DRM_FORMAT_ARGB8888,
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5399  			DRM_FORMAT_RGBA8888,
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5400  			DRM_FORMAT_ABGR8888,
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5401  		};
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5402  		uint32_t format = plane_state->fb->format->format;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5403  		unsigned int i;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5404  
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5405  		for (i = 0; i < ARRAY_SIZE(alpha_formats); ++i) {
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5406  			if (format == alpha_formats[i]) {
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5407  				*per_pixel_alpha = true;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5408  				break;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5409  			}
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5410  		}
76818cdd11a25a Sung Joon Kim       2022-05-19  5411  
76818cdd11a25a Sung Joon Kim       2022-05-19 @5412  		if (per_pixel_alpha && plane_state->pixel_blend_mode == DRM_MODE_BLEND_COVERAGE)

No point in checking "per_pixel_alpha".  I think it's supposed to be
checking asterisks "*per_pixel_alpha" instead.

76818cdd11a25a Sung Joon Kim       2022-05-19  5413  			*pre_multiplied_alpha = false;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5414  	}
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5415  
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5416  	if (plane_state->alpha < 0xffff) {
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5417  		*global_alpha = true;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5418  		*global_alpha_value = plane_state->alpha >> 8;
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5419  	}
d74004b694ea88 Nicholas Kazlauskas 2019-02-21  5420  }

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ