From aaac291341bc25f69b19264e2337b5201b1e5146 Mon Sep 17 00:00:00 2001 From: Abhijit Kulkarni Date: Thu, 5 Jan 2017 11:05:23 -0800 Subject: [PATCH] msm: mdss: fix use of uninitialized local variable This change fixes unitilized local variable being used and checks for the valid format in concurrent writeback case before using the format parameters. CRs-Fixed: 1110015 Change-Id: I61a3e20af1d0a4db7a7db454ae35b810639744ae Signed-off-by: Abhijit Kulkarni --- drivers/video/fbdev/msm/mdss_mdp_intf_writeback.c | 6 +++++- drivers/video/fbdev/msm/mdss_mdp_pp.c | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_writeback.c b/drivers/video/fbdev/msm/mdss_mdp_intf_writeback.c index 9bebd72dce61..e1d2a947a77f 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_intf_writeback.c +++ b/drivers/video/fbdev/msm/mdss_mdp_intf_writeback.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -521,6 +521,10 @@ int mdss_mdp_writeback_prepare_cwb(struct mdss_mdp_ctl *ctl, * updating img_width with buffer->planes[0].stride */ fmt = mdss_mdp_get_format_params(buffer->format); + if (!fmt) { + pr_err("invalid format for cwb\n"); + return -EINVAL; + } mdss_mdp_get_plane_sizes(fmt, ctx->img_width, buffer->height, &ps, 0, 0); diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c index 30dd3c856c7f..38dcf2b6cb78 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -5279,7 +5279,7 @@ static int pp_hist_collect(struct mdp_histogram_data *hist, u32 block) { int ret = 0; - u32 sum; + int sum = 0; char __iomem *v_base = NULL; unsigned long flag; struct mdss_data_type *mdata = mdss_mdp_get_mdata();