mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-26 12:20:14 +01:00
intel: avoid null pointer dereference
Move the dereference after the null check.
Fixes: 028715ee70 ("intel: Avoid the need for most overflow
checks by using a scratch page.")
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
This commit is contained in:
parent
1bf96af525
commit
5ee9cb4b4b
1 changed files with 2 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue