[Mesa-dev] [PATCH] llvmpipe: Fix incorrect sizeof.

Brian Paul brianp at vmware.com
Thu Nov 29 07:31:21 PST 2012


On 11/28/2012 11:52 PM, Vinson Lee wrote:
> Fixes sizeof not portable defects reported by Coverity.
>
> Signed-off-by: Vinson Lee<vlee at freedesktop.org>
> ---
>   src/gallium/drivers/llvmpipe/lp_state_fs.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
> index d702fc0..36ef1af 100644
> --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
> +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
> @@ -1158,7 +1158,7 @@ convert_to_blend_type(struct gallivm_state *gallivm,
>      unsigned pixels = 16 / num_srcs;
>      bool is_arith;
>
> -   memcpy(dst, src, sizeof(LLVMValueRef*) * num_srcs);
> +   memcpy(dst, src, sizeof(LLVMValueRef) * num_srcs);
>
>      lp_mem_type_from_format_desc(src_fmt,&mem_type);
>      lp_blend_type_from_format_desc(src_fmt,&blend_type);
> @@ -1260,7 +1260,7 @@ convert_from_blend_type(struct gallivm_state *gallivm,
>      unsigned pixels = 16 / num_srcs;
>      bool is_arith;
>
> -   memcpy(dst, src, sizeof(LLVMValueRef*) * num_srcs);
> +   memcpy(dst, src, sizeof(LLVMValueRef) * num_srcs);
>
>      lp_mem_type_from_format_desc(src_fmt,&mem_type);
>      lp_blend_type_from_format_desc(src_fmt,&blend_type);

Looks good.  Should probably be tagged as a candidate for the stable 
branches.

Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the mesa-dev mailing list