disp: msm: add proper null checks and propagate error
Fix possible null pointer dereferencing and propagate error code during early return. Signed-off-by: Samantha Tran <samtran@codeaurora.org>
This commit is contained in:
@@ -493,12 +493,17 @@ int dp_connector_atomic_check(struct drm_connector *connector,
|
|||||||
struct drm_connector_state *c_state)
|
struct drm_connector_state *c_state)
|
||||||
{
|
{
|
||||||
struct sde_connector *sde_conn;
|
struct sde_connector *sde_conn;
|
||||||
struct drm_connector_state *old_state =
|
struct drm_connector_state *old_state;
|
||||||
drm_atomic_get_old_connector_state(c_state->state, connector);
|
|
||||||
|
|
||||||
if (!connector || !display)
|
if (!connector || !display)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
old_state =
|
||||||
|
drm_atomic_get_old_connector_state(c_state->state, connector);
|
||||||
|
|
||||||
|
if (!old_state)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
sde_conn = to_sde_connector(connector);
|
sde_conn = to_sde_connector(connector);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -378,8 +378,10 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
|
|||||||
const struct drm_format_info *info;
|
const struct drm_format_info *info;
|
||||||
|
|
||||||
info = drm_format_info(mode_cmd->pixel_format);
|
info = drm_format_info(mode_cmd->pixel_format);
|
||||||
if (!info || num_planes > ARRAY_SIZE(info->cpp))
|
if (!info || num_planes > ARRAY_SIZE(info->cpp)) {
|
||||||
|
ret = -EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < num_planes; i++) {
|
for (i = 0; i < num_planes; i++) {
|
||||||
unsigned int width = mode_cmd->width / (i ? hsub : 1);
|
unsigned int width = mode_cmd->width / (i ? hsub : 1);
|
||||||
|
Reference in New Issue
Block a user