[PATCH 1/6] drm/syncobj: Avoid double memset in drm_syncobj_find_fence
Tvrtko Ursulin
tursulin at igalia.com
Thu Jan 2 19:44:12 UTC 2025
From: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
On kernels hardened with CONFIG_INIT_STACK_ALL_ZERO we can avoid the
double memset by moving the memory clearing to the declaration block. That
way the compiler can notice and only emit it once.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
---
drivers/gpu/drm/drm_syncobj.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 4f2ab8a7b50f..49cda394db5b 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -437,8 +437,8 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
struct dma_fence **fence)
{
struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
- struct syncobj_wait_entry wait;
u64 timeout = nsecs_to_jiffies64(DRM_SYNCOBJ_WAIT_FOR_SUBMIT_TIMEOUT);
+ struct syncobj_wait_entry wait = { };
int ret;
if (flags & ~DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT)
@@ -479,7 +479,6 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
goto out;
- memset(&wait, 0, sizeof(wait));
wait.task = current;
wait.point = point;
drm_syncobj_fence_add_wait(syncobj, &wait);
--
2.47.1
More information about the dri-devel
mailing list