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: <202203091542.wWXRk9o1-lkp@intel.com>
Date:   Wed, 9 Mar 2022 13:31:07 +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>,
        Aric Cyr <Aric.Cyr@....com>
Subject: drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018
 dce110_edp_backlight_control() error: we previously assumed
 'link->panel_cntl' could be null (see line 977)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   330f4c53d3c2d8b11d86ec03a964b86dc81452f5
commit: 06ddcee49a35981835e04910bef462a09f108984 drm/amd/display: Added multi instance support for panel control
config: powerpc-randconfig-m031-20220301 (https://download.01.org/0day-ci/archive/20220309/202203091542.wWXRk9o1-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.2.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/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

8a31820b12187c7 Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644b Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644b Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644b Yue Hin Lau       2017-09-15   966  {
069d418f412ec4b Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644b Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
06ddcee49a35981 Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644b Yue Hin Lau       2017-09-15   970  
069d418f412ec4b Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644b Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644b Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644b Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644b Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   976  
014427adc5565a0 Sherry            2020-11-11  @977  	if (link->panel_cntl) {
                                                            ^^^^^^^^^^^^^^^^
This code assumes "link->panel_cntl" can be NULL

014427adc5565a0 Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a0 Sherry            2020-11-11   979  
014427adc5565a0 Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a0 Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644b Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644b Yue Hin Lau       2017-09-15   985  		}
014427adc5565a0 Sherry            2020-11-11   986  	}
5eefbc40173644b Yue Hin Lau       2017-09-15   987  
5eefbc40173644b Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644b Yue Hin Lau       2017-09-15   989  
1296423bf23c7a5 Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644b Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644b Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644b Yue Hin Lau       2017-09-15   993  
5eefbc40173644b Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644b Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644b Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625df Andrew Jiang      2017-09-25   997  
5eefbc40173644b Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644b Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644b Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644b Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644b Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644b Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b5 Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644b Yue Hin Lau       2017-09-15  1005  
5eefbc40173644b Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644b Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644b Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644b Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644b Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644b Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644b Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644b Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644b Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644b Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644b Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7df Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
06ddcee49a35981 Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^^^^^^^
Unchecked dereference

5180d4a4766d7df Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7df Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97f Chris Park        2020-08-05  1021  
8a0e210c048e97f Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97f Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97f Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97f Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
06ddcee49a35981 Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1028  		else
8a0e210c048e97f Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
06ddcee49a35981 Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
06ddcee49a35981 Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97f Chris Park        2020-08-05  1032  	}
8a0e210c048e97f Chris Park        2020-08-05  1033  
069d418f412ec4b Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a13317 Hersen Wu         2020-01-14  1035  
96577cf82a13317 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a13317 Hersen Wu         2020-01-14  1038  
96577cf82a13317 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a13317 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a13317 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a13317 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a13317 Hersen Wu         2020-01-14  1043  
69b9723a81e74e5 Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7df Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337ef Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a13317 Hersen Wu         2020-01-14  1047  
96577cf82a13317 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a13317 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644b Yue Hin Lau       2017-09-15  1050  }

---
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