Mesa (master): clover: Use cl_ulong in the maximum allocation size calculation to avoid overflow.

Francisco Jerez currojerez at kemper.freedesktop.org
Wed Jan 15 11:27:32 UTC 2014


Module: Mesa
Branch: master
Commit: e457aca7fa477bfa2fbd57f1d0c8155206cfd8e8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e457aca7fa477bfa2fbd57f1d0c8155206cfd8e8

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Tue Jan 14 21:38:11 2014 +0100

clover: Use cl_ulong in the maximum allocation size calculation to avoid overflow.

---

 src/gallium/state_trackers/clover/api/memory.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/clover/api/memory.cpp b/src/gallium/state_trackers/clover/api/memory.cpp
index b8b3692..e51a729 100644
--- a/src/gallium/state_trackers/clover/api/memory.cpp
+++ b/src/gallium/state_trackers/clover/api/memory.cpp
@@ -37,7 +37,7 @@ clCreateBuffer(cl_context d_ctx, cl_mem_flags flags, size_t size,
       throw error(CL_INVALID_HOST_PTR);
 
    if (!size ||
-       size > fold(maximum(), 0u,
+       size > fold(maximum(), cl_ulong(0),
                    map(std::mem_fn(&device::max_mem_alloc_size), ctx.devs())
           ))
       throw error(CL_INVALID_BUFFER_SIZE);




More information about the mesa-commit mailing list