Ensure we never write more than we said we would.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Orig-LKML-Reference: <
20090325113316.
921433024@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
struct perf_counter *counter;
struct perf_mmap_data *data;
unsigned int offset;
+ unsigned int head;
int wakeup;
};
handle->counter = counter;
handle->data = data;
handle->offset = offset;
+ handle->head = head;
handle->wakeup = (offset >> PAGE_SHIFT) != (head >> PAGE_SHIFT);
return 0;
} while (len);
handle->offset = offset;
+
+ WARN_ON_ONCE(handle->offset > handle->head);
}
#define perf_output_put(handle, x) \