summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2023-02-15 13:28:45 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-20 02:29:06 +0300
commitb47b0ef1ba34e351228b57ce7ba74efc6d7b2c24 (patch)
treea5bfd96927145cfda37b65802fb8142453586577
parent6062acc1b8664ade91b4609ea056badd6f1e6802 (diff)
downloadlinux-b47b0ef1ba34e351228b57ce7ba74efc6d7b2c24.tar.xz
drm/xe/query: zero the region info
There are also some reserved fields in here which are not currently cleared when handing back to userspace. Otherwise we might run into issues if we later wish to use them. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Reviewed-by: Lucas De Marchi lucas.demarchi@intel.com Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
-rw-r--r--drivers/gpu/drm/xe/xe_query.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
index 6e904e97f456..f9f21bd1bfd7 100644
--- a/drivers/gpu/drm/xe/xe_query.c
+++ b/drivers/gpu/drm/xe/xe_query.c
@@ -115,16 +115,13 @@ static int query_memory_usage(struct xe_device *xe,
return -EINVAL;
}
- usage = kmalloc(size, GFP_KERNEL);
+ usage = kzalloc(size, GFP_KERNEL);
if (XE_IOCTL_ERR(xe, !usage))
return -ENOMEM;
- usage->pad = 0;
-
man = ttm_manager_type(&xe->ttm, XE_PL_TT);
usage->regions[0].mem_class = XE_MEM_REGION_CLASS_SYSMEM;
usage->regions[0].instance = 0;
- usage->regions[0].pad = 0;
usage->regions[0].min_page_size = PAGE_SIZE;
usage->regions[0].max_page_size = PAGE_SIZE;
usage->regions[0].total_size = man->size << PAGE_SHIFT;
@@ -138,7 +135,6 @@ static int query_memory_usage(struct xe_device *xe,
XE_MEM_REGION_CLASS_VRAM;
usage->regions[usage->num_regions].instance =
usage->num_regions;
- usage->regions[usage->num_regions].pad = 0;
usage->regions[usage->num_regions].min_page_size =
xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ?
SZ_64K : PAGE_SIZE;