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;
|
size_t len = 0;
|
||||||
struct dss_clk_mmrm_cb mmrm_cb_data;
|
struct dss_clk_mmrm_cb mmrm_cb_data;
|
||||||
struct mmrm_client_notifier_data notifier_data;
|
struct mmrm_client_notifier_data notifier_data;
|
||||||
struct dp_display *dp_display = debug->display;
|
struct dp_display *dp_display;
|
||||||
int cb_type;
|
int cb_type;
|
||||||
|
|
||||||
if (!debug)
|
if (!debug)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if (*ppos)
|
if (*ppos)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
dp_display = debug->display;
|
||||||
|
|
||||||
len = min_t(size_t, count, SZ_8 - 1);
|
len = min_t(size_t, count, SZ_8 - 1);
|
||||||
if (copy_from_user(buf, user_buff, len))
|
if (copy_from_user(buf, user_buff, len))
|
||||||
return 0;
|
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)
|
if (display->panel && !display->panel->host_config.ext_bridge_mode)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (!bridge)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
for (i = 0; i < display->ext_bridge_cnt; i++) {
|
for (i = 0; i < display->ext_bridge_cnt; i++) {
|
||||||
struct dsi_display_ext_bridge *ext_bridge_info =
|
struct dsi_display_ext_bridge *ext_bridge_info =
|
||||||
&display->ext_bridge[i];
|
&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,
|
ext_conn = list_last_entry(&drm->mode_config.connector_list,
|
||||||
struct drm_connector, head);
|
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)
|
drm_connector_for_each_possible_encoder(ext_conn, c_encoder)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -502,7 +502,7 @@ static bool sde_crtc_mode_fixup(struct drm_crtc *crtc,
|
|||||||
struct drm_connector *connector;
|
struct drm_connector *connector;
|
||||||
struct drm_encoder *encoder;
|
struct drm_encoder *encoder;
|
||||||
struct drm_connector_state *new_conn_state;
|
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;
|
bool encoder_valid = false;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -526,12 +526,12 @@ static bool sde_crtc_mode_fixup(struct drm_crtc *crtc,
|
|||||||
|
|
||||||
for_each_new_connector_in_state(c_state->state, connector,
|
for_each_new_connector_in_state(c_state->state, connector,
|
||||||
new_conn_state, i) {
|
new_conn_state, i) {
|
||||||
if (new_conn_state->best_encoder == encoder){
|
if (new_conn_state->best_encoder == encoder) {
|
||||||
|
c_conn_state = to_sde_connector_state(new_conn_state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c_conn_state = to_sde_connector_state(new_conn_state);
|
|
||||||
if (!c_conn_state) {
|
if (!c_conn_state) {
|
||||||
SDE_ERROR("could not get connector state\n");
|
SDE_ERROR("could not get connector state\n");
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user