video: tegra: hdmi: validate variable screeninfo
pdabade [Tue, 10 Dec 2013 05:12:01 +0000 (10:12 +0530)]
verify variable screeninfo by checking xres and yres before
validating aspect ratio.

bug 1417318

Change-Id: I473f3e2f30888c053ca53559e33355f216d2a8d3
Signed-off-by: Pankaj Dabade <pdabade@nvidia.com>
Reviewed-on: http://git-master/r/340236
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jong Kim <jongk@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>

drivers/video/tegra/dc/hdmi.c

index 55d9163..f3fcf2e 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2010 Google, Inc.
  * Author: Erik Gilling <konkers@android.com>
  *
- * Copyright (c) 2010-2012, NVIDIA CORPORATION, All rights reserved.
+ * Copyright (c) 2010-2013, NVIDIA CORPORATION, All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -1259,7 +1259,8 @@ static bool tegra_dc_hdmi_valid_asp_ratio(const struct tegra_dc *dc,
        int s_aspratio = 0;
 
        /* To check the aspect upto two decimal digits, calculate in % */
-       m_aspratio = (mode->xres*100 / mode->yres);
+       if (mode->yres)
+               m_aspratio = (mode->xres*100 / mode->yres);
 
        if ((m_aspratio < TEGRA_DC_HDMI_MIN_ASPECT_RATIO_PERCENT) ||
                        (m_aspratio > TEGRA_DC_HDMI_MAX_ASPECT_RATIO_PERCENT))