From ba742cd90731557f31cc4bda0ab276a6dba32504 Mon Sep 17 00:00:00 2001 From: "Zhengrong.Zhu" Date: Fri, 1 Nov 2019 15:07:45 +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: If325bcd7ca3a7f85cd17ac8b57e4a15284231ccc Signed-off-by: Zhengrong Zhu --- drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h | 6 +++--- drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h index 7d3712c..c76f4f3 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h @@ -34,20 +34,20 @@ #include "hdmi_rx_edid.h" -#define RX_VER0 "ver.2019-10-09" +#define RX_VER0 "ver.2019/10/21" /* * * * * */ -#define RX_VER1 "ver.2019/10/21" +#define RX_VER1 "ver.2019/10/17" /* * * * */ -#define RX_VER2 "ver.2019/10/17" +#define RX_VER2 "ver.2019/11/01" /*print type*/ #define LOG_EN 0x01 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 93dbec1..688771a 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_edid.c @@ -3439,7 +3439,8 @@ unsigned char *compose_audio_db(uint8_t *aud_db, uint8_t *add_buf) /* copy ramin Short Audio Descriptors * in add_buf, except blk header */ - memcpy(com_aud+idx, tmp_buf+1, add_buf_len-1); + 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; @@ -3586,10 +3587,6 @@ void splice_data_blk_to_edid(uint8_t *p_edid, uint8_t *add_buf, free_size += (tag_db_len-add_db_len); free_space_off = 255-free_size; memset(&p_edid[free_space_off], 0, free_size); - } else if (add_db_len - tag_db_len > DB_LEN_MAX-1) { - /* data block is maxmium 32bytes, minimum 1byte */ - rx_pr("illegal add data blk len: %d\n", add_db_len); - return; } else if (add_db_len - tag_db_len <= free_size) { /* move data behind current data * block, except checksum -- 2.7.4