Mesa (master): util/format: initialize non-important components to 0

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 30 10:59:36 UTC 2020


Module: Mesa
Branch: master
Commit: 28f258536581a740c8da8803cafbd5dc2711efd0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=28f258536581a740c8da8803cafbd5dc2711efd0

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Fri Jul 24 18:59:41 2020 +0200

util/format: initialize non-important components to 0

Avoids copying random garbage from the stack.

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>

---

 src/util/format/u_format_pack.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/format/u_format_pack.py b/src/util/format/u_format_pack.py
index 3307027bbbd..15c6be72e15 100644
--- a/src/util/format/u_format_pack.py
+++ b/src/util/format/u_format_pack.py
@@ -593,7 +593,7 @@ def generate_pack_kernel(format, src_channel, src_native_type):
     def pack_into_struct(channels, swizzles):
         inv_swizzle = inv_swizzles(swizzles)
 
-        print('         struct util_format_%s pixel;' % format.short_name())
+        print('         struct util_format_%s pixel = {0};' % format.short_name())
     
         for i in range(4):
             dst_channel = channels[i]



More information about the mesa-commit mailing list