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 <zhengrong.zhu@amlogic.com>
This commit is contained in:
Zhengrong.Zhu
2019-11-02 11:38:11 +08:00
committed by Luke Go
parent cdd8ccd594
commit 75848e4daf

View File

@@ -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;