intel: avoid null pointer dereference
PATCH 1/1 intel: avoid null pointer dereference
Introduced in 028715ee
Move the dereference after the null check.
--- intel/intel_decode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
intel/intel_decode.c +2 -1
@@ -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 );
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 3 lines · Thomas Hindoe Paaboel Andersen
Introduced in
028715eeMove the dereference after the null check.
checks by using a scratch page.")
Quoted 28 lines
--- intel/intel_decode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)intel/intel_decode.c +2
-1@@ -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 );Signature · 1 line
2.9.3
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Eric Engestrom
Quoted 3 lines · Thomas Hindoe Paaboel Andersen
Introduced in
028715eeMove the dereference after the null check.
Fixes 028715ee707469189505 ("intel: Avoid the need for most overflowchecks by using a scratch page.")
Reviewed-by Eric Engestrom <[email protected]>
Thanks. I do not have commit access. Can I ask you to push it?
Quoted 17 lines
Quoted 17 lines
--- intel/intel_decode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)intel/intel_decode.c +1
-1@@ -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;
Quoted 12 lines
Quoted 10 lines
intel/intel_decode.c +1
-1if (!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 ); --Quoted 2 lines
2.9.3
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Thomas H.P. Andersen
Quoted 4 lines · Eric Engestrom
Quoted 2 lines · Thomas Hindoe Paaboel Andersen
Introduced in
028715ee
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Move the dereference after the null check.
Fixes 028715ee707469189505 ("intel: Avoid the need for most overflowchecks by using a scratch page.")
Reviewed-by Eric Engestrom <[email protected]>Thanks. I do not have commit access. Can I ask you to push it?
I actually don't have commit access to libdrm either :)
Emil, can you push this (and the autogen patches)?
Cheers,
Eric
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
--- intel/intel_decode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)intel/intel_decode.c +1
-1@@ -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;
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
intel/intel_decode.c +0
-0if (!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. Quoted 8 lines
Quoted 8 lines
intel/intel_decode.c +1
-1*/ + size = ctx->base_count *4 ; temp =malloc (size +4096 );memcpy (temp, ctx->base_data, size);memset ((char *)temp + size,0xd0 ,4096 ); --2.9.3
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel