diff options
author | Tapasweni Pathak <tapaswenipathak@gmail.com> | 2015-03-06 05:39:40 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-03 00:10:38 +0300 |
commit | 4eaa3a6cc4c577103d678492ec50979b3aa360a4 (patch) | |
tree | 8d9de85d40ac685b0728718d54945589d9fa4dbf /drivers/media/platform/vivid | |
parent | 64bf8049a2ec1e61e1475eb02b5514d7061d443e (diff) | |
download | linux-4eaa3a6cc4c577103d678492ec50979b3aa360a4.tar.xz |
[media] drivers: media: platform: vivid: Fix possible null derefrence
Check for dev_fmt being null before derefrencing it, to assign it
to planes.
Found using Coccinelle.
Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/vivid')
-rw-r--r-- | drivers/media/platform/vivid/vivid-vid-out.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/platform/vivid/vivid-vid-out.c b/drivers/media/platform/vivid/vivid-vid-out.c index 39ff79f6aa67..8f081bbb7f2c 100644 --- a/drivers/media/platform/vivid/vivid-vid-out.c +++ b/drivers/media/platform/vivid/vivid-vid-out.c @@ -114,7 +114,7 @@ static int vid_out_buf_prepare(struct vb2_buffer *vb) { struct vivid_dev *dev = vb2_get_drv_priv(vb->vb2_queue); unsigned long size; - unsigned planes = dev->fmt_out->planes; + unsigned planes; unsigned p; dprintk(dev, 1, "%s\n", __func__); @@ -122,6 +122,8 @@ static int vid_out_buf_prepare(struct vb2_buffer *vb) if (WARN_ON(NULL == dev->fmt_out)) return -EINVAL; + planes = dev->fmt_out->planes; + if (dev->buf_prepare_error) { /* * Error injection: test what happens if buf_prepare() returns |