ring-buffer: check for divide by zero in ring-buffer-benchmark
authorSteven Rostedt <srostedt@redhat.com>
Fri, 8 May 2009 15:03:57 +0000 (11:03 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Mon, 11 May 2009 17:22:26 +0000 (13:22 -0400)
Although we check if "missed" is not zero, we divide by hit + missed,
and the addition can possible overflow and become a divide by zero.

This patch checks for this case, and will report it when it happens
then modify "hit" to make the calculation be non zero.

[ Impact: prevent possible divide by zero in ring-buffer-benchmark ]

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

No differences found