Skip to content

Commit

Permalink
MLK-12277 media: camera: add check for width and height against 0
Browse files Browse the repository at this point in the history
when do vte test it meets follow dump in small probability.
Add against-0 check to resovle this.

$ v4l_emma.sh 1 1
$ v4l_emma.sh 1 9

------------[ cut here ]------------
:  /dev/video1 Set PARM sucessfulWARNING: CPU: 0 PID: 1123 at /home/bamboo/build/4.1.X-1.0.0_ga/fsl-
imx-fb/temp_build_dir/build_fsl-imx-fb/tmp/work-shared/imx6qdlsolo/kernel-source/mm/page_alloc.c:266
5 __alloc_pages_nodemask+0x3c8/0x894()
ly
v4l_capture_testapp    0  TINModules linked in:FO  :  /dev/video1 input formatti mx6s_captureng pass
v4l_capture_testapp    0 ov5640_camera  TINFO  :  PRP_ENC_ON_D gpRGBcon evbugv_buf malloc pass!

CPU: 0 PID: 1123 Comm: v4l2_capture_em Not tainted 4.1.8-1.0.0+g87e6c2f #1
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015d84>] (unwind_backtrace) from [<80012728>] (show_stack+0x10/0x14)
[<80012728>] (show_stack) from [<80750a54>] (dump_stack+0x84/0xc4)
[<80750a54>] (dump_stack) from [<80032f3c>] (warn_slowpath_common+0x80/0xb0)
[<80032f3c>] (warn_slowpath_common) from [<80033008>] (warn_slowpath_null+0x1c/0x24)
[<80033008>] (warn_slowpath_null) from [<800b2cc4>] (__alloc_pages_nodemask+0x3c8/0x894)
[<800b2cc4>] (__alloc_pages_nodemask) from [<8001ba3c>] (__dma_alloc_buffer.isra.3+0x2c/0x84)
[<8001ba3c>] (__dma_alloc_buffer.isra.3) from [<8001bab0>] (__alloc_remap_buffer.isra.6+0x1c/0x8c)
[<8001bab0>] (__alloc_remap_buffer.isra.6) from [<8001bd1c>] (__dma_alloc+0x1fc/0x228)
[<8001bd1c>] (__dma_alloc) from [<8001be78>] (arm_dma_alloc+0x8c/0xa0)
[<8001be78>] (arm_dma_alloc) from [<804cd934>] (vb2_dc_alloc+0x68/0x100)
[<804cd934>] (vb2_dc_alloc) from [<804c7df8>] (__vb2_queue_alloc+0x134/0x4d0)
[<804c7df8>] (__vb2_queue_alloc) from [<804ca794>] (__reqbufs.isra.17+0x1a8/0x304)
[<804ca794>] (__reqbufs.isra.17) from [<804b7ac0>] (__video_do_ioctl+0x2b0/0x324)
[<804b7ac0>] (__video_do_ioctl) from [<804b753c>] (video_usercopy+0x1b8/0x480)
[<804b753c>] (video_usercopy) from [<804b3f34>] (v4l2_ioctl+0x118/0x150)
[<804b3f34>] (v4l2_ioctl) from [<800f8360>] (do_vfs_ioctl+0x3e8/0x608)
[<800f8360>] (do_vfs_ioctl) from [<800f85b4>] (SyS_ioctl+0x34/0x5c)
[<800f85b4>] (SyS_ioctl) from [<8000f480>] (ret_fast_syscall+0x0/0x3c)
---[ end trace 55ed68f89eca4805 ]---
mx6s-csi 21c4000.csi: dma_alloc_coherent of size 0 failed

Signed-off-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 2c1fa93)
  • Loading branch information
Robby Cai authored and wigcheng committed May 9, 2016
1 parent 1ba2b70 commit bbabad7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/media/platform/mxc/subdev/mx6s_capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,12 @@ static int mx6s_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
return -EINVAL;
}

if (f->fmt.pix.width == 0 || f->fmt.pix.height == 0) {
dev_err(csi_dev->dev, "width %d, height %d is too small.\n",
f->fmt.pix.width, f->fmt.pix.height);
return -EINVAL;
}

v4l2_fill_mbus_format(&mbus_fmt, pix, fmt->mbus_code);
ret = v4l2_subdev_call(sd, video, s_mbus_fmt, &mbus_fmt);
v4l2_fill_pix_format(pix, &mbus_fmt);
Expand Down

0 comments on commit bbabad7

Please sign in to comment.