Commit 9232fa05 authored by Michael Riesch's avatar Michael Riesch Committed by Mauro Carvalho Chehab
Browse files

media: synopsys: csi2rx: fix out-of-bounds check for formats array



The out-of-bounds check for the format array is off by one. Fix the
check.

Fixes: 355a1100 ("media: synopsys: add driver for the designware mipi csi-2 receiver")
Cc: stable@kernel.org
Suggested-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarMichael Riesch <michael.riesch@collabora.com>
Reviewed-by: default avatarFrank Li <Frank.Li@nxp.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent f338e773
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -301,7 +301,7 @@ dw_mipi_csi2rx_enum_mbus_code(struct v4l2_subdev *sd,

		return 0;
	case DW_MIPI_CSI2RX_PAD_SINK:
		if (code->index > csi2->formats_num)
		if (code->index >= csi2->formats_num)
			return -EINVAL;

		code->code = csi2->formats[code->index].code;