drm/amdgpu: Remove hidden double memset from amdgpu_cs_ioctl()
Subsystems (2)
PATCH 1/1 drm/amdgpu: Remove hidden double memset from amdgpu_cs_ioctl()
From: Tvrtko Ursulin <[email protected]>
When CONFIG_INIT_STACK_ALL_ZERO is set and so -ftrivial-auto-var-init=zero compiler option active, compiler fails to notice that inside amdgpu_cs_parser_init() there is a second memset to clear the same on stack struct amdgpu_cs_parser.
If we pull this memset one level out, into the amdgpu_cs_ioctl(), compiler can then see it and avoid clearing this struct twice.
Signed-off-by Tvrtko Ursulin <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
@@ -51,7 +51,6 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p,if (cs->in.num_chunks ==0 )return -EINVAL ; -memset (p,0 ,sizeof (*p)); p->adev = adev; p->filp = filp;
@@ -1411,6 +1410,7 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)if (!adev->accel_working)return -EBUSY ; +memset (&parser,0 ,sizeof (parser)); r =amdgpu_cs_parser_init (&parser, adev, filp, data);if (r) {DRM_ERROR_RATELIMITED ("Failed to initialize parser %d!\n" , r);
Signature · 1 line
2.44.0