All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, Ramalingam C <ramalingam.c@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org, kbuild-all@01.org,
	dri-devel@lists.freedesktop.org
Subject: [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?
Date: Fri, 10 May 2019 13:13:18 +0300	[thread overview]
Message-ID: <20190510101318.GD16030@kadam> (raw)

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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@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  }

                 reply	other threads:[~2019-05-10 10:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190510101318.GD16030@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kbuild-all@01.org \
    --cc=kbuild@01.org \
    --cc=ramalingam.c@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.