[Mesa-dev] [android-x86-devel] [RFC 2/7] tgsi: fix stack allocated struct may not be initialized
Emil Velikov
emil.l.velikov at gmail.com
Fri Apr 29 09:25:08 UTC 2016
On 28 April 2016 at 08:34, Chih-Wei Huang <cwhuang at android-x86.org> wrote:
> From: WuZhen <wuzhen at jidemail.com>
>
> NO_REF_TASK
> tested: local run
>
> Change-Id: Ied449126c2059d2654afebdf68972cb00862a4ce
> Signed-off-by: Chih-Wei Huang <cwhuang at linux.org.tw>
> ---
> src/gallium/auxiliary/tgsi/tgsi_dump.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
> index f232f38..66d801d 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
> @@ -432,6 +432,7 @@ tgsi_dump_declaration(
> const struct tgsi_full_declaration *decl )
> {
> struct dump_ctx ctx;
> + memset(&ctx, 0, sizeof(ctx));
>
> ctx.dump_printf = dump_ctx_printf;
>
> @@ -480,6 +481,7 @@ void tgsi_dump_property(
> const struct tgsi_full_property *prop )
> {
> struct dump_ctx ctx;
> + memset(&ctx, 0, sizeof(ctx));
>
> ctx.dump_printf = dump_ctx_printf;
>
> @@ -511,6 +513,7 @@ tgsi_dump_immediate(
> const struct tgsi_full_immediate *imm )
> {
> struct dump_ctx ctx;
> + memset(&ctx, 0, sizeof(ctx));
>
> ctx.dump_printf = dump_ctx_printf;
>
> @@ -671,6 +674,7 @@ tgsi_dump_instruction(
> uint instno )
> {
> struct dump_ctx ctx;
> + memset(&ctx, 0, sizeof(ctx));
>
> ctx.instno = instno;
> ctx.immno = instno;
> @@ -696,6 +700,7 @@ void
> tgsi_dump_to_file(const struct tgsi_token *tokens, uint flags, FILE *file)
> {
> struct dump_ctx ctx;
> + memset(&ctx, 0, sizeof(ctx));
>
> ctx.iter.prolog = prolog;
> ctx.iter.iterate_instruction = iter_instruction;
> @@ -766,6 +771,7 @@ tgsi_dump_str(
> size_t size)
> {
> struct str_dump_ctx ctx;
> + memset(&ctx, 0, sizeof(ctx));
>
> ctx.base.iter.prolog = prolog;
> ctx.base.iter.iterate_instruction = iter_instruction;
> @@ -805,6 +811,7 @@ tgsi_dump_instruction_str(
> size_t size)
> {
> struct str_dump_ctx ctx;
> + memset(&ctx, 0, sizeof(ctx));
>
Looks great afaict.
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
-Emil
More information about the mesa-dev
mailing list