[Mesa-dev] [PATCH] ac: fix possible truncation of intrinsic name

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Jun 7 10:24:05 UTC 2018


It doesn't fix a truncation though, as even though type is 8 chars we
never write the full size (I think our max is 5 chars), but GCC is
apparently not smart enough to see that.

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>


On Thu, Jun 7, 2018 at 2:30 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> Fixes the gcc warning:
> snprintf’ output between 26 and 33 bytes into a destination of size 32
>
> Fixes: d5f7ebda3ec0 ("ac: add LLVM build functions for subgroup instrinsics")
> ---
>  src/amd/common/ac_llvm_build.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
> index a686b72287b..681b4fcbcb9 100644
> --- a/src/amd/common/ac_llvm_build.c
> +++ b/src/amd/common/ac_llvm_build.c
> @@ -2980,7 +2980,7 @@ static LLVMValueRef
>  ac_build_set_inactive(struct ac_llvm_context *ctx, LLVMValueRef src,
>                       LLVMValueRef inactive)
>  {
> -       char name[32], type[8];
> +       char name[33], type[8];
>         LLVMTypeRef src_type = LLVMTypeOf(src);
>         src = ac_to_integer(ctx, src);
>         inactive = ac_to_integer(ctx, inactive);
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list