drivers: staging: cedrus: find ctx before dereferencing it ctx
authorColin Ian King <colin.king@canonical.com>
Fri, 2 Nov 2018 19:01:26 +0000 (19:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Nov 2018 12:08:28 +0000 (13:08 +0100)
commitb7c56d7bfe834904d9d332e0cfbf929b75976f8a
tree03d4534fc77d920e8cc57af4dd1ad680c25b65af
parentc3e43d8b958bd6849817393483e805d8638a8ab7
drivers: staging: cedrus: find ctx before dereferencing it ctx

Currently if count is an invalid value the v4l2_info message will
dereference a null ctx pointer to get the dev information. Fix
this by finding ctx first and then checking for an invalid count,
this way ctxt will be non-null hence avoiding the null pointer
dereference.

Detected by CoverityScan, CID#1475337 ("Explicit null dereferenced")

Fixes: 50e761516f2b ("media: platform: Add Cedrus VPU decoder driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/sunxi/cedrus/cedrus.c