From e1f41e5bdc16264bb3729b1e046f8b7f2af584b5 Mon Sep 17 00:00:00 2001 From: "Zhengrong.Zhu" Date: Wed, 8 Jan 2020 16:57:24 +0800 Subject: [PATCH] hdmitx: null pointer in hdmitx_set_vsif_pkt when driver early suspend [1/1] PD#SWPL-19636 Problem: null pointer in hdmitx_set_vsif_pkt when driver early suspend Solution: Check the pointer, if the pointer is null then use the default val. Verify: verify on the board of U212 Change-Id: I106ba2b72843cf1aa4ae15bcd7b1bbbda4fa6a71 Signed-off-by: Zhengrong Zhu --- .../vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c index 8722c4822557..841d54337a13 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c @@ -1380,12 +1380,16 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data) static unsigned char DRM_DB[26] = {0x0}; hdmi_debug(); - memcpy(&drm_config_data, data, sizeof(struct master_display_info_s)); - + if (data) + memcpy(&drm_config_data, data, + sizeof(struct master_display_info_s)); + else + memset(&drm_config_data, 0, + sizeof(struct master_display_info_s)); if (hsty_drm_config_loc > 7) hsty_drm_config_loc = 0; memcpy(&hsty_drm_config_data[hsty_drm_config_loc++], - data, sizeof(struct master_display_info_s)); + &drm_config_data, sizeof(struct master_display_info_s)); if (hsty_drm_config_num < 8) hsty_drm_config_num++; else @@ -1601,7 +1605,12 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type, static uint8_t ltmode = -1; hdmi_debug(); - memcpy(&vsif_debug_info.data, data, sizeof(struct dv_vsif_para)); + if (data == NULL) + memcpy(&vsif_debug_info.data, ¶, + sizeof(struct dv_vsif_para)); + else + memcpy(&vsif_debug_info.data, data, + sizeof(struct dv_vsif_para)); vsif_debug_info.type = type; vsif_debug_info.tunnel_mode = tunnel_mode; vsif_debug_info.signal_sdr = signal_sdr; @@ -1846,11 +1855,16 @@ static void hdmitx_set_hdr10plus_pkt(unsigned int flag, hdmi_debug(); - memcpy(&hdr10p_config_data, data, sizeof(struct hdr10plus_para)); + if (data) + memcpy(&hdr10p_config_data, data, + sizeof(struct hdr10plus_para)); + else + memset(&hdr10p_config_data, 0, + sizeof(struct hdr10plus_para)); if (hsty_hdr10p_config_loc > 7) hsty_hdr10p_config_loc = 0; memcpy(&hsty_hdr10p_config_data[hsty_hdr10p_config_loc++], - data, sizeof(struct hdr10plus_para)); + &hdr10p_config_data, sizeof(struct hdr10plus_para)); if (hsty_hdr10p_config_num < 8) hsty_hdr10p_config_num++; else @@ -1944,6 +1958,11 @@ static void hdmitx_set_emp_pkt(unsigned char *data, unsigned int type, hdmi_debug(); + if (!data) { + pr_info("the data is null\n"); + return; + } + emp_config_data.type = type; emp_config_data.size = size; if (size <= 128) @@ -1956,10 +1975,6 @@ static void hdmitx_set_emp_pkt(unsigned char *data, unsigned int type, return; } - if (!data) { - pr_info("the data is null\n"); - return; - } if (size <= 21) { number = 1; remainder = size;