[kbuild] [linux-next:master 12597/13745] 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)

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git  master
head:   50b8b1d699ac313c0a07a3c185ffb23aecab8abb
commit: e922057b556d37c54f8f88e44f7d7b731d6365b1 [12597/13745] drm/amd/display: Added support for multiple eDP BL control
config: x86_64-randconfig-m001-20210419 (attached as .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@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

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)
                                                           ^^^^^^^^^^
This code assumed "panel_cntl" can be 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@xxxxxxxxxxxx 

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@xxxxxxxxxxxx
To unsubscribe send an email to kbuild-leave@xxxxxxxxxxxx

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux