Re: [Mesa-dev] [PATCH] anv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL

2016-11-22 Thread Emil Velikov
On 20 November 2016 at 11:44, Mun Gwan-gyeong  wrote:
> pCreateInfo->strideInBytes * pCreateInfo->extent.height with type
> "unsigned int" is evaluated using 32-bit arithmetic.
> This fixes unintentional integer overflow by casting to uint64_t before
> multifying.
>
> CID 1394321
>

Thanks for the patch Mun, I've applied some minor polish and pushed
everything but the anv_block_pool_init patch.
That one requires a bit more work, such that it doesn't paper over
(too much) the other issues.

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] anv: Fix unintentional integer overflow in anv_CreateDmaBufImageINTEL

2016-11-20 Thread Mun Gwan-gyeong
pCreateInfo->strideInBytes * pCreateInfo->extent.height with type
"unsigned int" is evaluated using 32-bit arithmetic.
This fixes unintentional integer overflow by casting to uint64_t before
multifying.

CID 1394321

Signed-off-by: Mun Gwan-gyeong 
---
 src/intel/vulkan/anv_intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_intel.c b/src/intel/vulkan/anv_intel.c
index 1c50e2b..8b251f8 100644
--- a/src/intel/vulkan/anv_intel.c
+++ b/src/intel/vulkan/anv_intel.c
@@ -55,7 +55,7 @@ VkResult anv_CreateDmaBufImageINTEL(
   goto fail;
}
 
-   uint64_t size = pCreateInfo->strideInBytes * pCreateInfo->extent.height;
+   uint64_t size = (uint64_t)pCreateInfo->strideInBytes * 
(uint64_t)pCreateInfo->extent.height;
 
anv_bo_init(>bo, gem_handle, size);
 
-- 
2.10.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev