disp: msm: add check for null pointer dereferencing
Add check for null pointers before accessing. Change-Id: I33deb1e931098c246326a01e743a2db760320471 Signed-off-by: Samantha Tran <samtran@codeaurora.org>
This commit is contained in:
@@ -633,13 +633,16 @@ static ssize_t dp_debug_mmrm_clk_cb_write(struct file *file,
|
||||
size_t len = 0;
|
||||
struct dss_clk_mmrm_cb mmrm_cb_data;
|
||||
struct mmrm_client_notifier_data notifier_data;
|
||||
struct dp_display *dp_display = debug->display;
|
||||
struct dp_display *dp_display;
|
||||
int cb_type;
|
||||
|
||||
if (!debug)
|
||||
return -ENODEV;
|
||||
if (*ppos)
|
||||
return 0;
|
||||
|
||||
dp_display = debug->display;
|
||||
|
||||
len = min_t(size_t, count, SZ_8 - 1);
|
||||
if (copy_from_user(buf, user_buff, len))
|
||||
return 0;
|
||||
|
@@ -6321,6 +6321,9 @@ int dsi_display_drm_ext_bridge_init(struct dsi_display *display,
|
||||
if (display->panel && !display->panel->host_config.ext_bridge_mode)
|
||||
return 0;
|
||||
|
||||
if (!bridge)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < display->ext_bridge_cnt; i++) {
|
||||
struct dsi_display_ext_bridge *ext_bridge_info =
|
||||
&display->ext_bridge[i];
|
||||
@@ -6371,6 +6374,14 @@ int dsi_display_drm_ext_bridge_init(struct dsi_display *display,
|
||||
ext_conn = list_last_entry(&drm->mode_config.connector_list,
|
||||
struct drm_connector, head);
|
||||
|
||||
if (!ext_conn) {
|
||||
DSI_ERR("failed to get external connector\n");
|
||||
rc = PTR_ERR(ext_conn);
|
||||
|
||||
spin_unlock_irq(&drm->mode_config.connector_list_lock);
|
||||
goto error;
|
||||
}
|
||||
|
||||
drm_connector_for_each_possible_encoder(ext_conn, c_encoder)
|
||||
break;
|
||||
|
||||
|
@@ -502,7 +502,7 @@ static bool sde_crtc_mode_fixup(struct drm_crtc *crtc,
|
||||
struct drm_connector *connector;
|
||||
struct drm_encoder *encoder;
|
||||
struct drm_connector_state *new_conn_state;
|
||||
struct sde_connector_state *c_conn_state;
|
||||
struct sde_connector_state *c_conn_state = NULL;
|
||||
bool encoder_valid = false;
|
||||
int i;
|
||||
|
||||
@@ -527,11 +527,11 @@ static bool sde_crtc_mode_fixup(struct drm_crtc *crtc,
|
||||
for_each_new_connector_in_state(c_state->state, connector,
|
||||
new_conn_state, i) {
|
||||
if (new_conn_state->best_encoder == encoder) {
|
||||
c_conn_state = to_sde_connector_state(new_conn_state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
c_conn_state = to_sde_connector_state(new_conn_state);
|
||||
if (!c_conn_state) {
|
||||
SDE_ERROR("could not get connector state\n");
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user