]> www.infradead.org Git - linux.git/commitdiff
drm/xe/xe_sync: initialise ufence.signalled
authorMatthew Auld <matthew.auld@intel.com>
Fri, 11 Oct 2024 13:36:34 +0000 (14:36 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Mon, 14 Oct 2024 08:14:31 +0000 (09:14 +0100)
We can incorrectly think that the fence has signalled, if we get a
non-zero value here from the kmalloc, which is quite plausible. Just use
kzalloc to prevent stuff like this.

Fixes: 977e5b82e090 ("drm/xe: Expose user fence from xe_sync_entry")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Nirmoy Das <nirmoy.das@intel.com>
Cc: <stable@vger.kernel.org> # v6.10+
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241011133633.388008-2-matthew.auld@intel.com
drivers/gpu/drm/xe/xe_sync.c

index bb3c2a8303623792d4631a8d5d16f08cdf1d8cfb..c6cf227ead40c0e60c843e237ce33289f4c6511a 100644 (file)
@@ -58,7 +58,7 @@ static struct xe_user_fence *user_fence_create(struct xe_device *xe, u64 addr,
        if (!access_ok(ptr, sizeof(*ptr)))
                return ERR_PTR(-EFAULT);
 
-       ufence = kmalloc(sizeof(*ufence), GFP_KERNEL);
+       ufence = kzalloc(sizeof(*ufence), GFP_KERNEL);
        if (!ufence)
                return ERR_PTR(-ENOMEM);