diff mbox

intel: Use memset instead of VG_CLEAR

Message ID 1384965518-4871-1-git-send-email-idr@freedesktop.org (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Romanick Nov. 20, 2013, 4:38 p.m. UTC
From: Ian Romanick <ian.d.romanick@intel.com>

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

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reported-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 intel/intel_bufmgr_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Vetter Nov. 20, 2013, 4:46 p.m. UTC | #1
On Wed, Nov 20, 2013 at 08:38:38AM -0800, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick@intel.com>
> 
> The ioctl expects that certain fields will be zeroed, so we should allow
> the helper function to actually work in non-Valgrind builds.
> 
> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
> Reported-by: Zhenyu Wang <zhenyuw@linux.intel.com>
> Cc: Damien Lespiau <damien.lespiau@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  intel/intel_bufmgr_gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
> index df6fcec..c11ed45 100644
> --- a/intel/intel_bufmgr_gem.c
> +++ b/intel/intel_bufmgr_gem.c
> @@ -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;
> -- 
> 1.8.1.4
>
Lespiau, Damien Nov. 20, 2013, 4:56 p.m. UTC | #2
On Wed, Nov 20, 2013 at 08:38:38AM -0800, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick@intel.com>
> 
> The ioctl expects that certain fields will be zeroed, so we should allow
> the helper function to actually work in non-Valgrind builds.
> 
> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
> Reported-by: Zhenyu Wang <zhenyuw@linux.intel.com>
> Cc: Damien Lespiau <damien.lespiau@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

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.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>

> ---
>  intel/intel_bufmgr_gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
> index df6fcec..c11ed45 100644
> --- a/intel/intel_bufmgr_gem.c
> +++ b/intel/intel_bufmgr_gem.c
> @@ -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;
> -- 
> 1.8.1.4
>
diff mbox

Patch

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index df6fcec..c11ed45 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -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;