提交 a1acc5d0 编写于 作者: B Bhawanpreet Lakha 提交者: Alex Deucher

drm/amd/display: Fix static analysis bug in validate_bksv

[Why]
static analysis throws the error below

Out-of-bounds read (OVERRUN)
Overrunning array of 5 bytes at byte offset 7 by dereferencing pointer
(uint64_t *)hdcp->auth.msg.hdcp1.bksv.

var n is going to contain  r0p and bcaps. if they are non-zero the count
will be wrong

How]
Use memcpy instead to avoid this.
Signed-off-by: NBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: NHarry Wentland <harry.wentland@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 30216900
......@@ -27,9 +27,11 @@
static inline enum mod_hdcp_status validate_bksv(struct mod_hdcp *hdcp)
{
uint64_t n = *(uint64_t *)hdcp->auth.msg.hdcp1.bksv;
uint64_t n = 0;
uint8_t count = 0;
memcpy(&n, hdcp->auth.msg.hdcp1.bksv, sizeof(uint64_t));
while (n) {
count++;
n &= (n - 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册