Skip to contentSkip to conversation

intel: Use memset instead of VG_CLEAR

PATCH In review Ian Romanick 3 participants 3 messages Nov 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel: Use memset instead of VG_CLEAR

From: Ian Romanick <[email protected]>

The ioctl expects that certain fields will be zeroed, so we should allow the helper function to actually work in non-Valgrind builds.

---
 intel/intel_bufmgr_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +1 -1
index df6fcec..c11ed45 100644
@@ -3033,7 +3033,7 @@ drm_intel_get_reset_stats(drm_intel_context *ctx,
 	if (ctx == NULL)
 		return -EINVAL;
 
-	VG_CLEAR(stats);
+	memset(&stats, 0, sizeof(stats));
 
 	bufmgr_gem = (drm_intel_bufmgr_gem *)ctx->bufmgr;
 	stats.ctx_id = ctx->ctx_id;
Signature · 1 line
1.8.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Ian Romanick

From: Ian Romanick <[email protected]>

The ioctl expects that certain fields will be zeroed, so we should allow the helper function to actually work in non-Valgrind builds.

Quoted 20 lines
---
 intel/intel_bufmgr_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +1 -1
index df6fcec..c11ed45 100644
@@ -3033,7 +3033,7 @@ drm_intel_get_reset_stats(drm_intel_context *ctx,
 	if (ctx == NULL)
 		return -EINVAL;
 
-	VG_CLEAR(stats);
+	memset(&stats, 0, sizeof(stats));
 
 	bufmgr_gem = (drm_intel_bufmgr_gem *)ctx->bufmgr;
 	stats.ctx_id = ctx->ctx_id;
Signature · 1 line
1.8.1.4
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Reviewed-by on v1 1/1
#2 lore raw
In reply to Ian Romanick
Quoted 9 lines · Ian Romanick

From: Ian Romanick <[email protected]>

The ioctl expects that certain fields will be zeroed, so we should allow the helper function to actually work in non-Valgrind builds.

I was thinking that I missed it in the (lidrm) review, but it's actually a newer patch that introduces the checks.

Lesson learned for next ioctl reviews (kernel), have a better pass on the input validation and think about rejecting reserved values.

Quoted 20 lines
---
 intel/intel_bufmgr_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
intel/intel_bufmgr_gem.c +1 -1
index df6fcec..c11ed45 100644
@@ -3033,7 +3033,7 @@ drm_intel_get_reset_stats(drm_intel_context *ctx,
 	if (ctx == NULL)
 		return -EINVAL;
 
-	VG_CLEAR(stats);
+	memset(&stats, 0, sizeof(stats));
 
 	bufmgr_gem = (drm_intel_bufmgr_gem *)ctx->bufmgr;
 	stats.ctx_id = ctx->ctx_id;
Signature · 1 line
1.8.1.4