⬢ DragonFlyBSD Kernel Audit
DF-4577 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/i915/intel_hdcp.c
+++ b/sys/dev/drm/i915/intel_hdcp.c
@@ -217,8 +217,9 @@ int intel_hdcp_validate_v_prime(struct intel_digital_port *intel_dig_port,
 		u8 *ksv = &ksv_fifo[i * DRM_HDCP_KSV_LEN];
 
 		/* Fill up the empty slots in sha_text and write it out */
+		/* NOTE: offset by sha_leftovers — slots 0..sha_leftovers-1 */
+		/* already hold the previous KSV's parked bytes.           */
 		sha_empty = sizeof(sha_text) - sha_leftovers;
 		for (j = 0; j < sha_empty; j++)
-			sha_text |= ksv[j] << ((sizeof(sha_text) - j - 1) * 8);
+			sha_text |= ksv[j] << ((sizeof(sha_text) - j - 1 - sha_leftovers) * 8);
 
 		ret = intel_write_sha_text(dev_priv, sha_text);
 		if (ret < 0)