clover: Use cl_ulong in the maximum allocation size calculation to avoid overflow.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 14 Jan 2014 20:38:11 +0000 (21:38 +0100)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 14 Jan 2014 21:10:24 +0000 (22:10 +0100)
src/gallium/state_trackers/clover/api/memory.cpp

index b8b3692a65daaf8ff55234a318d5b955101d6f02..e51a7291732333710f7ec722fce09a4d3cc8225f 100644 (file)
@@ -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);