[Mesa-dev] [PATCH] nvc0: Initialize ptr for unexpected sample_count on release builds.

Emil Velikov emil.l.velikov at gmail.com
Tue Aug 6 10:24:09 PDT 2013


On 04/08/13 08:51, Vinson Lee wrote:
> Fixes "Uninitialized pointer read" defect reported by Coverity.
> 
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Hi Vinson

This patch looks remarkably similar to the one I've sent a few weeks ago
- with yours having a lot better commit message :)

The way I see it (after a subtle hint from calim) this patch improves
the issue from "accessing undefined variable/array(ptr)" to
"array out of bounds" - sample_index must be zero but the caller can
choose a different value.

IMHO the most suitable approach would be to provide undefined data to
the caller (same as what the intel code does), like show below.


     case 8: ptr = ms8; break;
+#ifndef NDEBUG
       assert(0);
       break;
+#else
+      return;
+#endif

Cheers
Emil


More information about the mesa-dev mailing list