diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2024-09-27 13:17:24 +0200 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2024-09-27 13:17:41 +0200 |
commit | 9af0a7ce0f1e1421e9bda655aa6c41b9dc95c88b (patch) | |
tree | 9a17f18e78761fca38c6c7e33a49d809a69f0913 | |
parent | 8a21eae8649fa286ad376365cc3878a475b9963c (diff) | |
download | linux-riscv-9af0a7ce0f1e1421e9bda655aa6c41b9dc95c88b.tar.gz linux-riscv-9af0a7ce0f1e1421e9bda655aa6c41b9dc95c88b.tar.bz2 linux-riscv-9af0a7ce0f1e1421e9bda655aa6c41b9dc95c88b.zip |
gpu: drm: img: fix potential NULL pointer dereferenceaccepted/tizen/unified/x/asan/20241013.235657accepted/tizen/unified/x/20241006.081938
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I40d03860acef21452fa83b00215868bbd1391caa
-rw-r--r-- | drivers/gpu/drm/img-rogue/module_common.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/gpu/drm/img-rogue/module_common.c b/drivers/gpu/drm/img-rogue/module_common.c index 1f454c91fdb0..0dbee2b4c651 100644 --- a/drivers/gpu/drm/img-rogue/module_common.c +++ b/drivers/gpu/drm/img-rogue/module_common.c @@ -169,13 +169,22 @@ 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 + } else { + return NULL; + } + } else { + return NULL; + } } return NULL; |