Skip to content

Commit 031f01a

Browse files
committed
gpu: galcore: Don't add more nops than will fit in totalSize
If the first NOP falls on an odd address for some reason it would be possible that that we could overrun Context->totalSize. Adjust for this before we start the loop of adding NOP's. Signed-off-by: Jon Nettleton <[email protected]>
1 parent 60700de commit 031f01a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_context.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2956,14 +2956,12 @@ gckCONTEXT_Update(
29562956
/* Determine the location of the first NOP. */
29572957
nop = &buffer->logical[base + (attribCount | 1)];
29582958

2959+
if ((nop + (nopCount * 2)) >= buffer->logical + Context->totalSize)
2960+
nopCount = (buffer->logical + Context->totalSize - nop) / 2;
2961+
29592962
/* Fill the unused space with NOPs. */
29602963
for (i = 0; i < nopCount; i += 1)
29612964
{
2962-
if (nop >= buffer->logical + Context->totalSize)
2963-
{
2964-
break;
2965-
}
2966-
29672965
/* Generate a NOP command. */
29682966
*nop = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ?
29692967
31:27) - (0 ? 31:27) + 1) == 32) ? ~0U : (~(~0U << ((1 ? 31:27) - (0 ?

0 commit comments

Comments
 (0)