summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2024-11-04 16:23:33 +0100
committerMarek Szyprowski <m.szyprowski@samsung.com>2024-11-04 23:37:15 +0100
commit7eb352a67dbff0b2589617ef12f05d05ceb0058a (patch)
tree2988fadbd270788b19e116152e1e05fde5faf80c
parent861d1eecbdcd0efcfa13bcc3e0ab18263d4070f7 (diff)
downloadlinux-thead-7eb352a67dbff0b2589617ef12f05d05ceb0058a.tar.gz
linux-thead-7eb352a67dbff0b2589617ef12f05d05ceb0058a.tar.bz2
linux-thead-7eb352a67dbff0b2589617ef12f05d05ceb0058a.zip
gpu: drm: img: fix potential NULL pointer dereference
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Change-Id: I519c2289c9659deab1e348ef88ab05668eb9c8f7
-rw-r--r--drivers/gpu/drm/img-rogue/module_common.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/img-rogue/module_common.c b/drivers/gpu/drm/img-rogue/module_common.c
index aa7ace0dabd1..76d0dac52e34 100644
--- a/drivers/gpu/drm/img-rogue/module_common.c
+++ b/drivers/gpu/drm/img-rogue/module_common.c
@@ -158,13 +158,18 @@ CONNECTION_DATA *LinuxSyncConnectionFromFile(struct file *pFile)
if (pFile)
{
struct drm_file *psDRMFile = pFile->private_data;
- PVRSRV_CONNECTION_PRIV *psConnectionPriv = (PVRSRV_CONNECTION_PRIV*)psDRMFile->driver_priv;
+ if (psDRMFile) {
+ PVRSRV_CONNECTION_PRIV *psConnectionPriv = (PVRSRV_CONNECTION_PRIV*)psDRMFile->driver_priv;
+
+ if (psConnectionPriv) {
#if (PVRSRV_DEVICE_INIT_MODE == PVRSRV_LINUX_DEV_INIT_ON_CONNECT)
- return (CONNECTION_DATA*)psConnectionPriv->pvConnectionData;
+ return (CONNECTION_DATA*)psConnectionPriv->pvConnectionData;
#else
- return (CONNECTION_DATA*)psConnectionPriv->pvSyncConnectionData;
+ return (CONNECTION_DATA*)psConnectionPriv->pvSyncConnectionData;
#endif
+ }
+ }
}
return NULL;