[Piglit] [PATCH] util-cl: Fix non-portable sizeof.

Matt Turner mattst88 at gmail.com
Wed Dec 17 11:17:21 PST 2014


On Tue, Dec 16, 2014 at 10:47 PM, Vinson Lee <vlee at freedesktop.org> wrote:
> Fix Coverity "sizeof not portable" defect.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/util/piglit-framework-cl-program.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/util/piglit-framework-cl-program.c b/tests/util/piglit-framework-cl-program.c
> index d335486..f94525b 100644
> --- a/tests/util/piglit-framework-cl-program.c
> +++ b/tests/util/piglit-framework-cl-program.c
> @@ -287,7 +287,7 @@ piglit_cl_program_test_run(const int argc,
>         } else if(config->program_binary_file != NULL) {
>                 unsigned int length;
>                 size_t* lengths = malloc(sizeof(size_t) * env.context->num_devices);
> -               unsigned char** program_binaries = malloc(sizeof(unsigned char**) * env.context->num_devices);
> +               unsigned char** program_binaries = malloc(sizeof(unsigned char*) * env.context->num_devices);

Someone explain this one to me?

program_binaries is an unsigned char ** and that's what we're giving
to sizeof. What's wrong with sizeof(unsigned char **)?


More information about the Piglit mailing list