From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [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: Fri, 10 May 2019 13:11:42 +0300 Message-ID: <20190510101141.GC16030@kadam> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kbuild-bounces@lists.01.org Sender: "kbuild" To: kbuild@01.org, Ramalingam C Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org, kbuild-all@01.org, dri-devel@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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 Reported-by: Dan Carpenter 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