[Mesa-dev] [PATCH] st/mesa: init hash keys with memset(), not designated initializers
Eric Anholt
eric at anholt.net
Mon Mar 11 22:47:08 UTC 2019
Brian Paul <brianp at vmware.com> writes:
> Since the compiler may not zero-out padding in the object.
> Add a couple comments about this to prevent misunderstandings in
> the future.
>
> Fixes: 67d96816ff5 ("st/mesa: move, clean-up shader variant key decls/inits")
> ---
> src/mesa/state_tracker/st_atom_shader.c | 9 +++++++--
> src/mesa/state_tracker/st_program.c | 13 ++++++++++---
> 2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
> index ac7a1a5..a4475e2 100644
> --- a/src/mesa/state_tracker/st_atom_shader.c
> +++ b/src/mesa/state_tracker/st_atom_shader.c
> @@ -112,7 +112,10 @@ st_update_fp( struct st_context *st )
> !stfp->variants->key.bitmap) {
> shader = stfp->variants->driver_shader;
> } else {
> - struct st_fp_variant_key key = {0};
> + struct st_fp_variant_key key;
> +
> + /* use memset, not an initializer to be sure all memory is zeroed */
> + memset(&key, 0, sizeof(key));
Wait, what? We rely on this form of initialization all over, what's
changed?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190311/35fa7c10/attachment.sig>
More information about the mesa-dev
mailing list