[igt-dev] [PATCH i-g-t 07/21] overlay: Write out the assumption for kernel-provided data
Petri Latvala
petri.latvala at intel.com
Wed Jan 16 11:20:36 UTC 2019
The code assumes (correctly) that perf_event_header's size is
non-zero. Write that out so static analysis also knows it.
Signed-off-by: Petri Latvala <petri.latvala at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
overlay/gpu-perf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/overlay/gpu-perf.c b/overlay/gpu-perf.c
index 5629f826..7addd78d 100644
--- a/overlay/gpu-perf.c
+++ b/overlay/gpu-perf.c
@@ -494,6 +494,7 @@ int gpu_perf_update(struct gpu_perf *gp)
const struct perf_event_header *header;
header = (const struct perf_event_header *)(data + (tail & mask));
+ assert(header->size > 0);
if (header->size > head - tail)
break;
--
2.19.1
More information about the igt-dev
mailing list