diff mbox

drm/i915: Pair va_copy with va_end in i915_error_vprintf

Message ID 1391787650-29704-1-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Feb. 7, 2014, 3:40 p.m. UTC
Each invocation of va_copy() must be matched by a corresponding
invocation of va_end() in the same function.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_gpu_error.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Chris Wilson Feb. 7, 2014, 3:50 p.m. UTC | #1
On Fri, Feb 07, 2014 at 05:40:50PM +0200, Mika Kuoppala wrote:
> Each invocation of va_copy() must be matched by a corresponding
> invocation of va_end() in the same function.
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Though it looks like it was my fauly anyway.
-Chris
Daniel Vetter Feb. 7, 2014, 3:58 p.m. UTC | #2
On Fri, Feb 07, 2014 at 03:50:51PM +0000, Chris Wilson wrote:
> On Fri, Feb 07, 2014 at 05:40:50PM +0200, Mika Kuoppala wrote:
> > Each invocation of va_copy() must be matched by a corresponding
> > invocation of va_end() in the same function.
> > 
> > Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Though it looks like it was my fauly anyway.

I've added the regression notice and cc: stable (since the original patch
is in 3.12 and also cc: stable). Thanks for the patch.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index dc47bb9..000b369 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -146,7 +146,10 @@  static void i915_error_vprintf(struct drm_i915_error_state_buf *e,
 		va_list tmp;
 
 		va_copy(tmp, args);
-		if (!__i915_error_seek(e, vsnprintf(NULL, 0, f, tmp)))
+		len = vsnprintf(NULL, 0, f, tmp);
+		va_end(tmp);
+
+		if (!__i915_error_seek(e, len))
 			return;
 	}