Skip to content

Commit 7b065c5

Browse files
Dan Carpentermchehab
authored andcommitted
media: atomisp2: Array underflow in atomisp_enum_input()
The problem here is this code from atomisp_enum_input(): 581 int index = input->index; 582 583 if (index >= isp->input_cnt) 584 return -EINVAL; 585 586 if (!isp->inputs[index].camera) 587 return -EINVAL; "input->index" is a u32 which comes from the ioctl. We want negative values of "index" to be counted as -EINVAL but they aren't. I've fixed this by changing the type of "isp->input_cnt" to unsigned int. Fixes: a49d253 ("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>
1 parent b25db38 commit 7b065c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ struct atomisp_device {
275275
*/
276276
struct mutex streamoff_mutex;
277277

278-
int input_cnt;
278+
unsigned int input_cnt;
279279
struct atomisp_input_subdev inputs[ATOM_ISP_MAX_INPUTS];
280280
struct v4l2_subdev *flash;
281281
struct v4l2_subdev *motor;

0 commit comments

Comments
 (0)