Use cudaMemcpy2DToArray/cudaMemcpy2DFromArray() to do vertical reverse image copy

Hi:
My program use cudaMemcpy2DToArray/cudaMemcpy2DFromArray() to do vertical reverse image copy between OpenGL and cuda, the code like below:

void Cuda2Texture(void * cu_src_ptr, size_t cu_src_pitch,GLuint tex_id,int w, int h)
{
	CUresult cur;
	CUgraphicsResource cu_res = GetCuResource(tex_id);

	CUarray cu_ary;
	cur = cuGraphicsMapResources(1, &cu_res, NULL);
	cur = cuGraphicsSubResourceGetMappedArray(&cu_ary, cu_res, 0, 0);
	cur = (CUresult)cudaMemcpy2DToArray(
			(cudaArray_t)cu_ary, 0, 0,
			(void *)((char *)cu_src_ptr + cu_src_pitch * (h - 1)), (size_t)-cu_src_pitch,	// copy from last line of src image buffer,set buffPitch to negative
			w, h,
			cudaMemcpyDeviceToDevice);
	cur = cuGraphicsUnmapResources(1, &cu_res, NULL);
}

the function works well,but compiler report below warning:
warning C4146: unary minus operator applied to unsigned type, result still unsigned

compiler report this warning because the data type of “cu_src_pitch” is size_t,size_t is unsigned int64,I roughly pass a negative “cu_src_pitch” to cuda function, is it valid? Can I use a negative number as cuda mem pitch?

It seems quite evident to me that the function expects a size_t which is an unsigned quantity.

Therefore there is no formal/defined way to use a negative number as a pitch. The C++ language guarantees that it will be interpreted as an unsigned number at the calling point. If you then want to ask whether or not the function may have some behavior that effectively interprets a certain range of unsigned values as negative, I have no idea, I suppose you may have discovered some kind of 64-bit wrap-around, perhaps. I’m fairly certain such behavior is undocumented, if it exists at all.