[drm-intel:drm-intel-next-queued 4/6] drivers/gpu/drm/drm_hdcp.c:190 drm_hdcp_parse_hdcp2_srm() warn: mask and shift to zero

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

 



tree:   git://anongit.freedesktop.org/drm-intel drm-intel-next-queued
head:   c16fd9be70faf3c49a61700efd16018dd910e390
commit: 6498bf5800a302ef69e7f4914e727893f278bb2f [4/6] drm: revocation check at drm subsystem

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/gpu/drm/drm_hdcp.c:190 drm_hdcp_parse_hdcp2_srm() warn: mask and shift to zero

git remote add drm-intel git://anongit.freedesktop.org/drm-intel
git remote update drm-intel
git checkout 6498bf5800a302ef69e7f4914e727893f278bb2f
vim +190 drivers/gpu/drm/drm_hdcp.c

6498bf58 Ramalingam C 2019-05-07  151  static int drm_hdcp_parse_hdcp2_srm(const u8 *buf, size_t count)
6498bf58 Ramalingam C 2019-05-07  152  {
6498bf58 Ramalingam C 2019-05-07  153  	struct hdcp_srm_header *header;
6498bf58 Ramalingam C 2019-05-07  154  	u32 vrl_length, ksv_count, ksv_sz;
6498bf58 Ramalingam C 2019-05-07  155  
6498bf58 Ramalingam C 2019-05-07  156  	if (count < (sizeof(struct hdcp_srm_header) +
6498bf58 Ramalingam C 2019-05-07  157  	    DRM_HDCP_2_VRL_LENGTH_SIZE + DRM_HDCP_2_DCP_SIG_SIZE)) {
6498bf58 Ramalingam C 2019-05-07  158  		DRM_ERROR("Invalid blob length\n");
6498bf58 Ramalingam C 2019-05-07  159  		return -EINVAL;
6498bf58 Ramalingam C 2019-05-07  160  	}
6498bf58 Ramalingam C 2019-05-07  161  
6498bf58 Ramalingam C 2019-05-07  162  	header = (struct hdcp_srm_header *)buf;
6498bf58 Ramalingam C 2019-05-07  163  	DRM_DEBUG("SRM ID: 0x%x, SRM Ver: 0x%x, SRM Gen No: 0x%x\n",
6498bf58 Ramalingam C 2019-05-07  164  		  header->srm_id & DRM_HDCP_SRM_ID_MASK,
6498bf58 Ramalingam C 2019-05-07  165  		  be16_to_cpu(header->srm_version), header->srm_gen_no);
6498bf58 Ramalingam C 2019-05-07  166  
6498bf58 Ramalingam C 2019-05-07  167  	if (header->reserved)
6498bf58 Ramalingam C 2019-05-07  168  		return -EINVAL;
6498bf58 Ramalingam C 2019-05-07  169  
6498bf58 Ramalingam C 2019-05-07  170  	buf = buf + sizeof(*header);
6498bf58 Ramalingam C 2019-05-07  171  	vrl_length = get_vrl_length(buf);
6498bf58 Ramalingam C 2019-05-07  172  
6498bf58 Ramalingam C 2019-05-07  173  	if (count < (sizeof(struct hdcp_srm_header) + vrl_length) ||
6498bf58 Ramalingam C 2019-05-07  174  	    vrl_length < (DRM_HDCP_2_VRL_LENGTH_SIZE +
6498bf58 Ramalingam C 2019-05-07  175  	    DRM_HDCP_2_DCP_SIG_SIZE)) {
6498bf58 Ramalingam C 2019-05-07  176  		DRM_ERROR("Invalid blob length or vrl length\n");
6498bf58 Ramalingam C 2019-05-07  177  		return -EINVAL;
6498bf58 Ramalingam C 2019-05-07  178  	}
6498bf58 Ramalingam C 2019-05-07  179  
6498bf58 Ramalingam C 2019-05-07  180  	/* Length of the all vrls combined */
6498bf58 Ramalingam C 2019-05-07  181  	vrl_length -= (DRM_HDCP_2_VRL_LENGTH_SIZE +
6498bf58 Ramalingam C 2019-05-07  182  		       DRM_HDCP_2_DCP_SIG_SIZE);
6498bf58 Ramalingam C 2019-05-07  183  
6498bf58 Ramalingam C 2019-05-07  184  	if (!vrl_length) {
6498bf58 Ramalingam C 2019-05-07  185  		DRM_ERROR("No vrl found\n");
6498bf58 Ramalingam C 2019-05-07  186  		return -EINVAL;
6498bf58 Ramalingam C 2019-05-07  187  	}
6498bf58 Ramalingam C 2019-05-07  188  
6498bf58 Ramalingam C 2019-05-07  189  	buf += DRM_HDCP_2_VRL_LENGTH_SIZE;
6498bf58 Ramalingam C 2019-05-07 @190  	ksv_count = (*buf << 2) | DRM_HDCP_2_KSV_COUNT_2_LSBITS(*(buf + 1));

#define DRM_HDCP_2_KSV_COUNT_2_LSBITS(byte)     (((byte) & 0xC) >> 6)

0xC >> 6 is always zero.

6498bf58 Ramalingam C 2019-05-07  191  	if (!ksv_count) {
6498bf58 Ramalingam C 2019-05-07  192  		DRM_DEBUG("Revoked KSV count is 0\n");
6498bf58 Ramalingam C 2019-05-07  193  		return count;
6498bf58 Ramalingam C 2019-05-07  194  	}
6498bf58 Ramalingam C 2019-05-07  195  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux