dvfs: tegra: Validate CLDVFS register address tegra-l4t-r24.2
Alex Frid [Thu, 30 Jun 2016 01:21:46 +0000 (18:21 -0700)]
Bug 1783583

Change-Id: I8b0e865db02c00f741dafb473d4bd39c5075f23f
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/1201538
(cherry picked from commit 453a77c5cd9a1316307458203365f9eb5bda62de)
Reviewed-on: http://git-master/r/1201706
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
Tested-by: Winnie Hsu <whsu@nvidia.com>

drivers/platform/tegra/tegra_cl_dvfs.c

index c6606f9..9ebe1d6 100644 (file)
 
 #define CL_DVFS_OUTPUT_LUT             0x200
 
+#define CL_DVFS_APERTURE               0x400
+
 #define IS_I2C_OFFS(offs)              \
        ((((offs) >= CL_DVFS_I2C_CFG) && ((offs) <= CL_DVFS_INTR_EN)) || \
        ((offs) >= CL_DVFS_I2C_CNTRL))
@@ -3652,6 +3654,9 @@ static ssize_t cl_register_write(struct file *file,
        if (sscanf(buf, "[0x%x] = 0x%x", &offs, &val) != 2)
                return -1;
 
+       if (offs >= CL_DVFS_APERTURE)
+               return -1;
+
        clk_enable(cld->soc_clk);
        cl_dvfs_writel(cld, val, offs & (~0x3));
        clk_disable(cld->soc_clk);