panfrost: Remove vertex buffer offset from its size
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 22 Aug 2019 15:02:52 +0000 (08:02 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 22 Aug 2019 20:31:39 +0000 (13:31 -0700)
commiteeebf5c2dfbf68e8db5a9926bba7ae55ed7c1b54
tree5efb6afacfd5857b70caeeda839a72fdaf171f4c
parentf4678f3c620d52b55522494e306196e8047f8136
panfrost: Remove vertex buffer offset from its size

The offset is added to the base address, so we need to subtract it from
the size to maintain the same end address and thus prevent a buffer
overflow:

   end_address = start_address + size

   start_address' = start_address + offset
   size' = size - offset

   end_address' = start_address' + size'
                = (start_address + offset) + (size - offset)
                = (start_address + size) + (offset - offset)
                = start_address + size
                = end_address

   QED.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_instancing.c