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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202112182118.FZN5I3gV-lkp@intel.com>
Date:   Wed, 5 Jan 2022 12:38:15 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Jake Wang <haonan.wang2@....com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Alex Deucher <alexander.deucher@....com>
Subject: drivers/gpu/drm/amd/amdgpu/../display/dc/dcn21/dcn21_hwseq.c:222
 dcn21_set_backlight_level() error: we previously assumed 'panel_cntl' could
 be null (see line 213)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9eaa88c7036eda3f6c215f87ca693594cf90559b
commit: e922057b556d37c54f8f88e44f7d7b731d6365b1 drm/amd/display: Added support for multiple eDP BL control
config: x86_64-randconfig-m001-20211207 (https://download.01.org/0day-ci/archive/20211218/202112182118.FZN5I3gV-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn21/dcn21_hwseq.c:222 dcn21_set_backlight_level() error: we previously assumed 'panel_cntl' could be null (see line 213)

vim +/panel_cntl +222 drivers/gpu/drm/amd/amdgpu/../display/dc/dcn21/dcn21_hwseq.c

474ac4a875ca6f Yongqiang Sun 2020-04-27  198  bool dcn21_set_backlight_level(struct pipe_ctx *pipe_ctx,
474ac4a875ca6f Yongqiang Sun 2020-04-27  199  		uint32_t backlight_pwm_u16_16,
474ac4a875ca6f Yongqiang Sun 2020-04-27  200  		uint32_t frame_ramp)
474ac4a875ca6f Yongqiang Sun 2020-04-27  201  {
474ac4a875ca6f Yongqiang Sun 2020-04-27  202  	union dmub_rb_cmd cmd;
474ac4a875ca6f Yongqiang Sun 2020-04-27  203  	struct dc_context *dc = pipe_ctx->stream->ctx;
474ac4a875ca6f Yongqiang Sun 2020-04-27  204  	struct abm *abm = pipe_ctx->stream_res.abm;
474ac4a875ca6f Yongqiang Sun 2020-04-27  205  	uint32_t otg_inst = pipe_ctx->stream_res.tg->inst;
474ac4a875ca6f Yongqiang Sun 2020-04-27  206  	struct panel_cntl *panel_cntl = pipe_ctx->stream->link->panel_cntl;
474ac4a875ca6f Yongqiang Sun 2020-04-27  207  
474ac4a875ca6f Yongqiang Sun 2020-04-27  208  	if (dc->dc->res_pool->dmcu) {
474ac4a875ca6f Yongqiang Sun 2020-04-27  209  		dce110_set_backlight_level(pipe_ctx, backlight_pwm_u16_16, frame_ramp);
474ac4a875ca6f Yongqiang Sun 2020-04-27  210  		return true;
474ac4a875ca6f Yongqiang Sun 2020-04-27  211  	}
474ac4a875ca6f Yongqiang Sun 2020-04-27  212  
474ac4a875ca6f Yongqiang Sun 2020-04-27 @213  	if (abm && panel_cntl)
                                                           ^^^^^^^^^^
Check for NULL

474ac4a875ca6f Yongqiang Sun 2020-04-27  214  		dmub_abm_set_pipe(abm, otg_inst, SET_ABM_PIPE_NORMAL, panel_cntl->inst);
474ac4a875ca6f Yongqiang Sun 2020-04-27  215  
148816f93fa0db Wyatt Wood    2021-01-18  216  	memset(&cmd, 0, sizeof(cmd));
474ac4a875ca6f Yongqiang Sun 2020-04-27  217  	cmd.abm_set_backlight.header.type = DMUB_CMD__ABM;
474ac4a875ca6f Yongqiang Sun 2020-04-27  218  	cmd.abm_set_backlight.header.sub_type = DMUB_CMD__ABM_SET_BACKLIGHT;
474ac4a875ca6f Yongqiang Sun 2020-04-27  219  	cmd.abm_set_backlight.abm_set_backlight_data.frame_ramp = frame_ramp;
474ac4a875ca6f Yongqiang Sun 2020-04-27  220  	cmd.abm_set_backlight.abm_set_backlight_data.backlight_user_level = backlight_pwm_u16_16;
e922057b556d37 Jake Wang     2021-04-01  221  	cmd.abm_set_backlight.abm_set_backlight_data.version = DMUB_CMD_ABM_SET_BACKLIGHT_VERSION_1;
e922057b556d37 Jake Wang     2021-04-01 @222  	cmd.abm_set_backlight.abm_set_backlight_data.panel_mask = (0x01 << panel_cntl->inst);
                                                                                                                   ^^^^^^^^^^^^^^^^
Unchecked dereference

474ac4a875ca6f Yongqiang Sun 2020-04-27  223  	cmd.abm_set_backlight.header.payload_bytes = sizeof(struct dmub_cmd_abm_set_backlight_data);
474ac4a875ca6f Yongqiang Sun 2020-04-27  224  
474ac4a875ca6f Yongqiang Sun 2020-04-27  225  	dc_dmub_srv_cmd_queue(dc->dmub_srv, &cmd);
474ac4a875ca6f Yongqiang Sun 2020-04-27  226  	dc_dmub_srv_cmd_execute(dc->dmub_srv);
474ac4a875ca6f Yongqiang Sun 2020-04-27  227  	dc_dmub_srv_wait_idle(dc->dmub_srv);
474ac4a875ca6f Yongqiang Sun 2020-04-27  228  
474ac4a875ca6f Yongqiang Sun 2020-04-27  229  	return true;
474ac4a875ca6f Yongqiang Sun 2020-04-27  230  }

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ