summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2018-02-12 06:45:32 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-24 09:36:25 +0200
commit2fb28b075f80136b17c8aebb2c006a3502c628db (patch)
tree7796a686d21b7d604778f62bbfce0fd0ffef5728 /drivers/media
parent9864a1ef86791897b0f6c215001deae472c05635 (diff)
downloadlinux-stable-2fb28b075f80136b17c8aebb2c006a3502c628db.tar.gz
linux-stable-2fb28b075f80136b17c8aebb2c006a3502c628db.tar.bz2
linux-stable-2fb28b075f80136b17c8aebb2c006a3502c628db.zip
media: vivid: check if the cec_adapter is valid
commit ed356f110403f6acc64dcbbbfdc38662ab9b06c2 upstream. If CEC is not enabled for the vivid driver, then the adap pointer is NULL and 'adap->phys_addr' will fail. Cc: <stable@vger.kernel.org> # for v4.12 and up Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/vivid/vivid-vid-common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/platform/vivid/vivid-vid-common.c b/drivers/media/platform/vivid/vivid-vid-common.c
index f0f423c7ca41..6f6d4df1e8a8 100644
--- a/drivers/media/platform/vivid/vivid-vid-common.c
+++ b/drivers/media/platform/vivid/vivid-vid-common.c
@@ -858,7 +858,8 @@ int vidioc_g_edid(struct file *file, void *_fh,
return -EINVAL;
if (edid->start_block + edid->blocks > dev->edid_blocks)
edid->blocks = dev->edid_blocks - edid->start_block;
- cec_set_edid_phys_addr(dev->edid, dev->edid_blocks * 128, adap->phys_addr);
+ if (adap)
+ cec_set_edid_phys_addr(dev->edid, dev->edid_blocks * 128, adap->phys_addr);
memcpy(edid->edid, dev->edid + edid->start_block * 128, edid->blocks * 128);
return 0;
}