diff mbox

[04/12] intel: Validate pointer before using

Message ID 1427963547-23614-5-git-send-email-praveen.paneri@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Praveen Paneri April 2, 2015, 8:32 a.m. UTC
Move the dereferencing below the check for valid ctx pointer.

Signed-off-by: Praveen Paneri <praveen.paneri@intel.com>
---
 intel/intel_decode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/intel/intel_decode.c b/intel/intel_decode.c
index b70d949..5dab9ca 100644
--- a/intel/intel_decode.c
+++ b/intel/intel_decode.c
@@ -3901,12 +3901,14 @@  drm_intel_decode(struct drm_intel_decode *ctx)
 	int ret;
 	unsigned int index = 0;
 	uint32_t devid;
-	int size = ctx->base_count * 4;
+	int size;
 	void *temp;
 
 	if (!ctx)
 		return;
 
+	size = ctx->base_count * 4;
+
 	/* Put a scratch page full of obviously undefined data after
 	 * the batchbuffer.  This lets us avoid a bunch of length
 	 * checking in statically sized packets.