These > comparisons should be >=.  The formats->fmts[] array is either
a pointer to isp_formats_sink[] or isp_formats_source[] respectively.
Fixes: e57854628f58 ("media: staging: media: starfive: camss: Add ISP driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
        const struct stf_isp_format_table *formats;
 
        if (code->pad == STF_ISP_PAD_SINK) {
-               if (code->index > ARRAY_SIZE(isp_formats_sink))
+               if (code->index >= ARRAY_SIZE(isp_formats_sink))
                        return -EINVAL;
 
                formats = &isp_dev->formats[SINK_FORMATS_INDEX];
        } else {
                struct v4l2_mbus_framefmt *sink_fmt;
 
-               if (code->index > ARRAY_SIZE(isp_formats_source))
+               if (code->index >= ARRAY_SIZE(isp_formats_source))
                        return -EINVAL;
 
                sink_fmt = v4l2_subdev_state_get_format(state,