From ee01dc30c368a6d8eb6b30968d0eb7d65b26b576 Mon Sep 17 00:00:00 2001 From: "Zhengrong.Zhu" Date: Sat, 2 Nov 2019 11:38:11 +0800 Subject: [PATCH] hdmirx: Coverity defect cleanup:hdmi rx [1/1] PD#SWPL-15167 Problem: Coverity defect cleanup:hdmi rx Solution: Modify code according to coverity Verify: verify on the board of x3011 Change-Id: I1f8bac51101a5ae1a8a27ffd14e899b75ab99c04 Signed-off-by: Zhengrong Zhu --- drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c index 688771aa3a08..8bd5f2c7ba09 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c @@ -3439,8 +3439,9 @@ unsigned char *compose_audio_db(uint8_t *aud_db, uint8_t *add_buf) /* copy ramin Short Audio Descriptors * in add_buf, except blk header */ - if (idx + add_buf_len - 1 <= sizeof(com_aud)) - memcpy(com_aud + idx, tmp_buf + 1, add_buf_len - 1); + if (idx < sizeof(com_aud)) + if (idx + add_buf_len - 1 <= sizeof(com_aud)) + memcpy(com_aud + idx, tmp_buf + 1, add_buf_len - 1); payload_len = (idx - 1) + (add_buf_len - 1); /* data blk header */ com_aud[0] = (AUDIO_TAG << 5) | payload_len;