drm: Branch 'master'

[email protected] (Eric Engestr??m)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 intel/intel_decode.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 5ee9cb4b4b6964bcd463b0490f3027e6ccfbf45a
Author: Thomas Hindoe Paaboel Andersen <[email protected]>
Date:   Thu Feb 2 23:57:29 2017 +0100

    intel: avoid null pointer dereference
    
    Move the dereference after the null check.
    Fixes: 028715ee707469189505 ("intel: Avoid the need for most overflow
                                  checks by using a scratch page.")
    Reviewed-by: Eric Engestrom <[email protected]>

diff --git a/intel/intel_decode.c b/intel/intel_decode.c
index 803d202..2721ffd 100644
--- a/intel/intel_decode.c
+++ b/intel/intel_decode.c
@@ -3899,7 +3899,7 @@ 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)
@@ -3909,6 +3909,7 @@ drm_intel_decode(struct drm_intel_decode *ctx)
 	 * the batchbuffer.  This lets us avoid a bunch of length
 	 * checking in statically sized packets.
 	 */
+	size = ctx->base_count * 4;
 	temp = malloc(size + 4096);
 	memcpy(temp, ctx->base_data, size);
 	memset((char *)temp + size, 0xd0, 4096);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.