From: Liu Ying Date: Mon, 30 Nov 2015 03:46:00 +0000 (+0800) Subject: MLK-11918-4 video: mxc ipuv3 fb: Fix dangling pointer dereference in check_var X-Git-Tag: C0P2-H0.0--20200415~3995 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=939b2d3ce8c816a48f39b413bb246a233c82047c;p=linux.git MLK-11918-4 video: mxc ipuv3 fb: Fix dangling pointer dereference in check_var The function fbi_to_pixfmt() could access the pointer fbi->device provided by it's input parameter fbi, so let's make sure the pointer isn't dangling. This patch fixes the following issue reported by Coverity: Uninitialized pointer read (UNINIT) uninit_use_in_call: Using uninitialized value tmp_fbi.device when calling fbi_to_pixfmt. switch (fbi_to_pixfmt(&tmp_fbi, true)) { case IPU_PIX_FMT_YUV420P2: case IPU_PIX_FMT_YVU420P: Signed-off-by: Liu Ying --- diff --git a/drivers/video/fbdev/mxc/mxc_ipuv3_fb.c b/drivers/video/fbdev/mxc/mxc_ipuv3_fb.c index 6fe8d0f5fb71..38ea948325fe 100644 --- a/drivers/video/fbdev/mxc/mxc_ipuv3_fb.c +++ b/drivers/video/fbdev/mxc/mxc_ipuv3_fb.c @@ -1647,6 +1647,7 @@ static int mxcfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) fr_h = var->yres_virtual; } + tmp_fbi.device = info->device; tmp_fbi.var = *var; tmp_fbi.par = mxc_fbi; if (ipu_pixel_format_is_gpu_tile(var->nonstd)) {