diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-28 12:12:09 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-30 13:38:36 -0300 |
commit | b4bb1bd7c20aeaf51607e7ffdbcc9f3b79094185 (patch) | |
tree | 7872a81e27e67c9263b5f26abb57238de104deb4 /drivers/media | |
parent | 03e5dcee4cab0361b14ef575db455e8de546a3e5 (diff) | |
download | linux-b4bb1bd7c20aeaf51607e7ffdbcc9f3b79094185.tar.gz linux-b4bb1bd7c20aeaf51607e7ffdbcc9f3b79094185.tar.bz2 linux-b4bb1bd7c20aeaf51607e7ffdbcc9f3b79094185.zip |
[media] s3c-camif: Check if fmt is NULL before use
As reported by smatch:
drivers/media/platform/s3c-camif/camif-capture.c:463 queue_setup() warn: variable dereferenced before check 'fmt' (see line 460)
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/s3c-camif/camif-capture.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c index db4d7d23beb9..76e6289a5612 100644 --- a/drivers/media/platform/s3c-camif/camif-capture.c +++ b/drivers/media/platform/s3c-camif/camif-capture.c @@ -449,19 +449,22 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, struct camif_vp *vp = vb2_get_drv_priv(vq); struct camif_dev *camif = vp->camif; struct camif_frame *frame = &vp->out_frame; - const struct camif_fmt *fmt = vp->out_fmt; + const struct camif_fmt *fmt; unsigned int size; if (pfmt) { pix = &pfmt->fmt.pix; fmt = s3c_camif_find_format(vp, &pix->pixelformat, -1); + if (fmt == NULL) + return -EINVAL; size = (pix->width * pix->height * fmt->depth) / 8; } else { + fmt = vp->out_fmt; + if (fmt == NULL) + return -EINVAL; size = (frame->f_width * frame->f_height * fmt->depth) / 8; } - if (fmt == NULL) - return -EINVAL; *num_planes = 1; if (pix) |