From 15fc7c9de886d684cdaf37316de0b39a5d64f2d9 Mon Sep 17 00:00:00 2001 From: Petri Latvala Date: Wed, 16 Jan 2019 13:20:36 +0200 Subject: overlay: Write out the assumption for kernel-provided data 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 Cc: Chris Wilson Reviewed-by: Arkadiusz Hiler --- overlay/gpu-perf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'overlay') 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; -- cgit v1.2.3