aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/img-rogue/1.17/devicemem_history_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/img-rogue/1.17/devicemem_history_server.c')
-rw-r--r--drivers/gpu/drm/img-rogue/1.17/devicemem_history_server.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/gpu/drm/img-rogue/1.17/devicemem_history_server.c b/drivers/gpu/drm/img-rogue/1.17/devicemem_history_server.c
index ac6a11aa86ef58..3f49ee118d657f 100644
--- a/drivers/gpu/drm/img-rogue/1.17/devicemem_history_server.c
+++ b/drivers/gpu/drm/img-rogue/1.17/devicemem_history_server.c
@@ -1379,6 +1379,15 @@ PVRSRV_ERROR DevicememHistorySparseChangeKM(PMR *psPMR,
PVRSRV_ERROR eError;
IMG_BOOL bCreated;
+ if (!PMRValidateSize((IMG_UINT64) ui32AllocPageCount << ui32Log2PageSize))
+ {
+ PVR_LOG_VA(PVR_DBG_ERROR,
+ "PMR size exceeds limit #Chunks: %u ChunkSz %"IMG_UINT64_FMTSPECX"",
+ ui32AllocPageCount,
+ (IMG_UINT64) 1ULL << ui32Log2PageSize);
+ return PVRSRV_ERROR_PMR_TOO_LARGE;
+ }
+
if ((ui32AllocationIndex != DEVICEMEM_HISTORY_ALLOC_INDEX_NONE) &&
!CHECK_ALLOC_INDEX(ui32AllocationIndex))
{
@@ -1872,7 +1881,7 @@ static int DevicememHistoryPrintAllWrapper(OSDI_IMPL_ENTRY *psEntry,
static PVRSRV_ERROR CreateRecords(void)
{
gsDevicememHistoryData.sRecords.pasAllocations =
- OSAllocMem(sizeof(RECORD_ALLOCATION) * ALLOCATION_LIST_NUM_ENTRIES);
+ OSAllocZMem(sizeof(RECORD_ALLOCATION) * ALLOCATION_LIST_NUM_ENTRIES);
PVR_RETURN_IF_NOMEM(gsDevicememHistoryData.sRecords.pasAllocations);