media: staging: atomisp: fix bounds checking in mt9m114_s_exposure_selection()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 10 Aug 2017 12:23:34 +0000 (08:23 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sun, 27 Aug 2017 00:33:18 +0000 (20:33 -0400)
These clamp_t() calls are no-ops because we don't save the results.  It
leads to an array out of bounds bug.

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/staging/media/atomisp/i2c/mt9m114.c

index 36a0636a532f9ca11541fdd2bae6865ec663fe8b..3c837cb8859c8fe96fe50e1f73bc4aad5595e085 100644 (file)
@@ -1209,10 +1209,10 @@ static int mt9m114_s_exposure_selection(struct v4l2_subdev *sd,
                return -EINVAL;
        }
 
-       clamp_t(int, win_left, 0, 4);
-       clamp_t(int, win_top, 0, 4);
-       clamp_t(int, win_right, 0, 4);
-       clamp_t(int, win_bottom, 0, 4);
+       win_left   = clamp_t(int, win_left, 0, 4);
+       win_top    = clamp_t(int, win_top, 0, 4);
+       win_right  = clamp_t(int, win_right, 0, 4);
+       win_bottom = clamp_t(int, win_bottom, 0, 4);
 
        ret = mt9m114_write_reg_array(client, mt9m114_exp_average, NO_POLLING);
        if (ret) {