From ccd121acdb363e80a3cf00faaee1c9ff335e47a5 Mon Sep 17 00:00:00 2001 From: "Guoniu.Zhou" <guoniu.zhou@nxp.com> Date: Wed, 3 Apr 2019 16:13:44 +0800 Subject: [PATCH] MLK-20191-1: media: mxc: fix unsigned compare Fix coverity CID 17388, 17389 and 17363 issue Because the type of variable is unsigned, so compare with zero is no effect Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com> --- drivers/media/platform/mxc/capture/mxc_v4l2_capture.c | 4 ++-- drivers/media/platform/mxc/capture/ov5647_mipi.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c b/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c index 952b997d4728eb..b5b03169bfe199 100644 --- a/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c +++ b/drivers/media/platform/mxc/capture/mxc_v4l2_capture.c @@ -328,7 +328,7 @@ static int mxc_v4l2_buffer_status(cam_data *cam, struct v4l2_buffer *buf) { pr_debug("In MVC:mxc_v4l2_buffer_status\n"); - if (buf->index < 0 || buf->index >= FRAME_NUM) { + if (buf->index >= FRAME_NUM) { pr_err("ERROR: v4l2 capture: mxc_v4l2_buffer_status buffers " "not allocated\n"); return -EINVAL; @@ -348,7 +348,7 @@ static int mxc_v4l2_prepare_bufs(cam_data *cam, struct v4l2_buffer *buf) { pr_debug("In MVC:mxc_v4l2_prepare_bufs\n"); - if (buf->index < 0 || buf->index >= FRAME_NUM || buf->length < + if (buf->index >= FRAME_NUM || buf->length < PAGE_ALIGN(cam->v2f.fmt.pix.sizeimage)) { pr_err("ERROR: v4l2 capture: mxc_v4l2_prepare_bufs buffers " "not allocated,index=%d, length=%d\n", buf->index, diff --git a/drivers/media/platform/mxc/capture/ov5647_mipi.c b/drivers/media/platform/mxc/capture/ov5647_mipi.c index 109f77438f514c..327481f06c590d 100644 --- a/drivers/media/platform/mxc/capture/ov5647_mipi.c +++ b/drivers/media/platform/mxc/capture/ov5647_mipi.c @@ -1441,7 +1441,7 @@ static int ov5647_enum_frameintervals(struct v4l2_subdev *sd, { int i, j, count; - if (fie->index < 0 || fie->index > ov5647_mode_MAX) + if (fie->index > ov5647_mode_MAX) return -EINVAL; if (fie->width == 0 || fie->height == 0 || -- GitLab