[drm-intel:drm-intel-next 3/4] drivers/gpu/drm/i915/display/intel_dp_hdcp.c:582 intel_dp_hdcp2_read_msg() error: uninitialized symbol 'msg_end'.

Dan Carpenter dan.carpenter at oracle.com
Fri Apr 2 10:43:48 UTC 2021


tree:   git://anongit.freedesktop.org/drm-intel drm-intel-next
head:   b29854ec3b9ca6512a783e2153465f27a777a654
commit: 989cf9a93892409cf8e84c30c0faaa522ac83807 [3/4] drm/i915/hdcp: Add DP HDCP2.2 timeout to read entire msg
config: i386-randconfig-m031-20210401 (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 at intel.com>
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>

smatch warnings:
drivers/gpu/drm/i915/display/intel_dp_hdcp.c:582 intel_dp_hdcp2_read_msg() error: uninitialized symbol 'msg_end'.

vim +/msg_end +582 drivers/gpu/drm/i915/display/intel_dp_hdcp.c

d079b7e4b6389e Sean Paul      2020-08-18  526  static
d079b7e4b6389e Sean Paul      2020-08-18  527  int intel_dp_hdcp2_read_msg(struct intel_digital_port *dig_port,
d079b7e4b6389e Sean Paul      2020-08-18  528  			    u8 msg_id, void *buf, size_t size)
d079b7e4b6389e Sean Paul      2020-08-18  529  {
d079b7e4b6389e Sean Paul      2020-08-18  530  	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
d079b7e4b6389e Sean Paul      2020-08-18  531  	unsigned int offset;
d079b7e4b6389e Sean Paul      2020-08-18  532  	u8 *byte = buf;
d079b7e4b6389e Sean Paul      2020-08-18  533  	ssize_t ret, bytes_to_recv, len;
d079b7e4b6389e Sean Paul      2020-08-18  534  	const struct hdcp2_dp_msg_data *hdcp2_msg_data;
989cf9a9389240 Anshuman Gupta 2021-03-24  535  	ktime_t msg_end;
                                                ^^^^^^^^^^^^^^^^

989cf9a9389240 Anshuman Gupta 2021-03-24  536  	bool msg_expired;
d079b7e4b6389e Sean Paul      2020-08-18  537  
d079b7e4b6389e Sean Paul      2020-08-18  538  	hdcp2_msg_data = get_hdcp2_dp_msg_data(msg_id);
d079b7e4b6389e Sean Paul      2020-08-18  539  	if (!hdcp2_msg_data)
d079b7e4b6389e Sean Paul      2020-08-18  540  		return -EINVAL;
d079b7e4b6389e Sean Paul      2020-08-18  541  	offset = hdcp2_msg_data->offset;
d079b7e4b6389e Sean Paul      2020-08-18  542  
d079b7e4b6389e Sean Paul      2020-08-18  543  	ret = intel_dp_hdcp2_wait_for_msg(dig_port, hdcp2_msg_data);
d079b7e4b6389e Sean Paul      2020-08-18  544  	if (ret < 0)
d079b7e4b6389e Sean Paul      2020-08-18  545  		return ret;
d079b7e4b6389e Sean Paul      2020-08-18  546  
d079b7e4b6389e Sean Paul      2020-08-18  547  	if (msg_id == HDCP_2_2_REP_SEND_RECVID_LIST) {
d079b7e4b6389e Sean Paul      2020-08-18  548  		ret = get_receiver_id_list_size(dig_port);
d079b7e4b6389e Sean Paul      2020-08-18  549  		if (ret < 0)
d079b7e4b6389e Sean Paul      2020-08-18  550  			return ret;
d079b7e4b6389e Sean Paul      2020-08-18  551  
d079b7e4b6389e Sean Paul      2020-08-18  552  		size = ret;
d079b7e4b6389e Sean Paul      2020-08-18  553  	}
d079b7e4b6389e Sean Paul      2020-08-18  554  	bytes_to_recv = size - 1;
                                                ^^^^^^^^^^^^^^^^^^^^^^^^
Is it possible to for "size" to be 1?

d079b7e4b6389e Sean Paul      2020-08-18  555  
d079b7e4b6389e Sean Paul      2020-08-18  556  	/* DP adaptation msgs has no msg_id */
d079b7e4b6389e Sean Paul      2020-08-18  557  	byte++;
d079b7e4b6389e Sean Paul      2020-08-18  558  
d079b7e4b6389e Sean Paul      2020-08-18  559  	while (bytes_to_recv) {

In that case, we would never enter this loop.

d079b7e4b6389e Sean Paul      2020-08-18  560  		len = bytes_to_recv > DP_AUX_MAX_PAYLOAD_BYTES ?
d079b7e4b6389e Sean Paul      2020-08-18  561  		      DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_recv;
d079b7e4b6389e Sean Paul      2020-08-18  562  
989cf9a9389240 Anshuman Gupta 2021-03-24  563  		/* Entire msg read timeout since initiate of msg read */
989cf9a9389240 Anshuman Gupta 2021-03-24  564  		if (bytes_to_recv == size - 1 && hdcp2_msg_data->msg_read_timeout > 0)
989cf9a9389240 Anshuman Gupta 2021-03-24  565  			msg_end = ktime_add_ms(ktime_get_raw(),
989cf9a9389240 Anshuman Gupta 2021-03-24  566  					       hdcp2_msg_data->msg_read_timeout);
989cf9a9389240 Anshuman Gupta 2021-03-24  567  
d079b7e4b6389e Sean Paul      2020-08-18  568  		ret = drm_dp_dpcd_read(&dig_port->dp.aux, offset,
d079b7e4b6389e Sean Paul      2020-08-18  569  				       (void *)byte, len);
d079b7e4b6389e Sean Paul      2020-08-18  570  		if (ret < 0) {
d079b7e4b6389e Sean Paul      2020-08-18  571  			drm_dbg_kms(&i915->drm, "msg_id %d, ret %zd\n",
d079b7e4b6389e Sean Paul      2020-08-18  572  				    msg_id, ret);
d079b7e4b6389e Sean Paul      2020-08-18  573  			return ret;
d079b7e4b6389e Sean Paul      2020-08-18  574  		}
d079b7e4b6389e Sean Paul      2020-08-18  575  
d079b7e4b6389e Sean Paul      2020-08-18  576  		bytes_to_recv -= ret;
d079b7e4b6389e Sean Paul      2020-08-18  577  		byte += ret;
d079b7e4b6389e Sean Paul      2020-08-18  578  		offset += ret;
d079b7e4b6389e Sean Paul      2020-08-18  579  	}
989cf9a9389240 Anshuman Gupta 2021-03-24  580  
989cf9a9389240 Anshuman Gupta 2021-03-24  581  	if (hdcp2_msg_data->msg_read_timeout > 0) {
989cf9a9389240 Anshuman Gupta 2021-03-24 @582  		msg_expired = ktime_after(ktime_get_raw(), msg_end);
989cf9a9389240 Anshuman Gupta 2021-03-24  583  		if (msg_expired) {
989cf9a9389240 Anshuman Gupta 2021-03-24  584  			drm_dbg_kms(&i915->drm, "msg_id %d, entire msg read timeout(mSec): %d\n",
989cf9a9389240 Anshuman Gupta 2021-03-24  585  				    msg_id, hdcp2_msg_data->msg_read_timeout);
989cf9a9389240 Anshuman Gupta 2021-03-24  586  			return -ETIMEDOUT;
989cf9a9389240 Anshuman Gupta 2021-03-24  587  		}
989cf9a9389240 Anshuman Gupta 2021-03-24  588  	}
989cf9a9389240 Anshuman Gupta 2021-03-24  589  
d079b7e4b6389e Sean Paul      2020-08-18  590  	byte = buf;
d079b7e4b6389e Sean Paul      2020-08-18  591  	*byte = msg_id;
d079b7e4b6389e Sean Paul      2020-08-18  592  
d079b7e4b6389e Sean Paul      2020-08-18  593  	return size;
d079b7e4b6389e Sean Paul      2020-08-18  594  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 30429 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210402/4d225a03/attachment-0001.gz>


More information about the dri-devel mailing list