]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blobdiff - drivers/platform/tegra/tegra_cl_dvfs.c
dvfs: tegra: Validate CLDVFS register address
[sojka/nv-tegra/linux-3.10.git] / drivers / platform / tegra / tegra_cl_dvfs.c
index c6606f94d70573d80d255ab26cae00d545c81698..9ebe1d66dc65c785a17700dd09211c92041283a7 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);