[Intel-gfx] [drm-intel:drm-intel-next-queued 5/6] drivers/gpu/drm/i915/intel_hdcp.c:1406 hdcp2_authenticate_repeater_topology() warn: should this be a bitwise op?

Dan Carpenter dan.carpenter at oracle.com
Fri May 10 10:13:18 UTC 2019


tree:   git://anongit.freedesktop.org/drm-intel drm-intel-next-queued
head:   c16fd9be70faf3c49a61700efd16018dd910e390
commit: f26ae6a652f2e75a3a12ac22b7da5797978436c4 [5/6] drm/i915: SRM revocation check for HDCP1.4 and 2.2

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>

smatch warnings:
drivers/gpu/drm/i915/intel_hdcp.c:1406 hdcp2_authenticate_repeater_topology() warn: should this be a bitwise op?

git remote add drm-intel git://anongit.freedesktop.org/drm-intel
git remote update drm-intel
git checkout f26ae6a652f2e75a3a12ac22b7da5797978436c4
vim +1406 drivers/gpu/drm/i915/intel_hdcp.c

d849178e Ramalingam C 2019-02-16  1367  static
d849178e Ramalingam C 2019-02-16  1368  int hdcp2_authenticate_repeater_topology(struct intel_connector *connector)
d849178e Ramalingam C 2019-02-16  1369  {
d849178e Ramalingam C 2019-02-16  1370  	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
d849178e Ramalingam C 2019-02-16  1371  	struct intel_hdcp *hdcp = &connector->hdcp;
f26ae6a6 Ramalingam C 2019-05-07  1372  	struct drm_device *dev = connector->base.dev;
d849178e Ramalingam C 2019-02-16  1373  	union {
d849178e Ramalingam C 2019-02-16  1374  		struct hdcp2_rep_send_receiverid_list recvid_list;
d849178e Ramalingam C 2019-02-16  1375  		struct hdcp2_rep_send_ack rep_ack;
d849178e Ramalingam C 2019-02-16  1376  	} msgs;
d849178e Ramalingam C 2019-02-16  1377  	const struct intel_hdcp_shim *shim = hdcp->shim;
f26ae6a6 Ramalingam C 2019-05-07  1378  	u32 seq_num_v, device_cnt;
d849178e Ramalingam C 2019-02-16  1379  	u8 *rx_info;
d849178e Ramalingam C 2019-02-16  1380  	int ret;
d849178e Ramalingam C 2019-02-16  1381  
d849178e Ramalingam C 2019-02-16  1382  	ret = shim->read_2_2_msg(intel_dig_port, HDCP_2_2_REP_SEND_RECVID_LIST,
d849178e Ramalingam C 2019-02-16  1383  				 &msgs.recvid_list, sizeof(msgs.recvid_list));
d849178e Ramalingam C 2019-02-16  1384  	if (ret < 0)
d849178e Ramalingam C 2019-02-16  1385  		return ret;
d849178e Ramalingam C 2019-02-16  1386  
d849178e Ramalingam C 2019-02-16  1387  	rx_info = msgs.recvid_list.rx_info;
d849178e Ramalingam C 2019-02-16  1388  
d849178e Ramalingam C 2019-02-16  1389  	if (HDCP_2_2_MAX_CASCADE_EXCEEDED(rx_info[1]) ||
d849178e Ramalingam C 2019-02-16  1390  	    HDCP_2_2_MAX_DEVS_EXCEEDED(rx_info[1])) {
d849178e Ramalingam C 2019-02-16  1391  		DRM_DEBUG_KMS("Topology Max Size Exceeded\n");
d849178e Ramalingam C 2019-02-16  1392  		return -EINVAL;
d849178e Ramalingam C 2019-02-16  1393  	}
d849178e Ramalingam C 2019-02-16  1394  
d849178e Ramalingam C 2019-02-16  1395  	/* Converting and Storing the seq_num_v to local variable as DWORD */
0de655ca Ramalingam C 2019-05-07  1396  	seq_num_v =
0de655ca Ramalingam C 2019-05-07  1397  		drm_hdcp_be24_to_cpu((const u8 *)msgs.recvid_list.seq_num_v);
d849178e Ramalingam C 2019-02-16  1398  
d849178e Ramalingam C 2019-02-16  1399  	if (seq_num_v < hdcp->seq_num_v) {
d849178e Ramalingam C 2019-02-16  1400  		/* Roll over of the seq_num_v from repeater. Reauthenticate. */
d849178e Ramalingam C 2019-02-16  1401  		DRM_DEBUG_KMS("Seq_num_v roll over.\n");
d849178e Ramalingam C 2019-02-16  1402  		return -EINVAL;
d849178e Ramalingam C 2019-02-16  1403  	}
d849178e Ramalingam C 2019-02-16  1404  
f26ae6a6 Ramalingam C 2019-05-07  1405  	device_cnt = HDCP_2_2_DEV_COUNT_HI(rx_info[0]) << 4 ||
                                                                                                    ^^
Bitwise OR | was probably intended.

f26ae6a6 Ramalingam C 2019-05-07 @1406  			HDCP_2_2_DEV_COUNT_LO(rx_info[1]);
f26ae6a6 Ramalingam C 2019-05-07  1407  	if (drm_hdcp_check_ksvs_revoked(dev, msgs.recvid_list.receiver_ids,
f26ae6a6 Ramalingam C 2019-05-07  1408  					device_cnt)) {
f26ae6a6 Ramalingam C 2019-05-07  1409  		DRM_ERROR("Revoked receiver ID(s) is in list\n");
f26ae6a6 Ramalingam C 2019-05-07  1410  		return -EPERM;
f26ae6a6 Ramalingam C 2019-05-07  1411  	}
f26ae6a6 Ramalingam C 2019-05-07  1412  
d849178e Ramalingam C 2019-02-16  1413  	ret = hdcp2_verify_rep_topology_prepare_ack(connector,
d849178e Ramalingam C 2019-02-16  1414  						    &msgs.recvid_list,
d849178e Ramalingam C 2019-02-16  1415  						    &msgs.rep_ack);
d849178e Ramalingam C 2019-02-16  1416  	if (ret < 0)
d849178e Ramalingam C 2019-02-16  1417  		return ret;
d849178e Ramalingam C 2019-02-16  1418  
d849178e Ramalingam C 2019-02-16  1419  	hdcp->seq_num_v = seq_num_v;
d849178e Ramalingam C 2019-02-16  1420  	ret = shim->write_2_2_msg(intel_dig_port, &msgs.rep_ack,
d849178e Ramalingam C 2019-02-16  1421  				  sizeof(msgs.rep_ack));
d849178e Ramalingam C 2019-02-16  1422  	if (ret < 0)
d849178e Ramalingam C 2019-02-16  1423  		return ret;
d849178e Ramalingam C 2019-02-16  1424  
d849178e Ramalingam C 2019-02-16  1425  	return 0;
d849178e Ramalingam C 2019-02-16  1426  }

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation


More information about the Intel-gfx mailing list