trace-cmd: Add check for truncated files
trace-cmd: Add check for truncated files

If the trace data file that is being read is truncated, mmap'ing its
non-existent page does not give any error. When the page is read, the
process dies with a SIGBUS.

This patch adds a file size check while initializing the trace data and
makes sure that the file size matches the expected size; otherwise an
error is returned.

Cc: Michael Rubin <4fde2c96bbb2b79984d097dee9168089855814c5@google.com>
Cc: David Sharp <d17c0a8430b0bd65a7a6ae309f7a3dc190d92668@google.com>
Signed-off-by: Vaibhav Nagarnaik <1fa667586c90bce718fd3c486c1144f98789d483@google.com>
Link: http://lkml.kernel.org/r/1308615578-556-1-git-send-email-1fa667586c90bce718fd3c486c1144f98789d483@google.com
Signed-off-by: Steven Rostedt <43232e92d70cc7aa53504ad0397085ee47bad87f@goodmis.org>

bigzz/trace-cmd,bigzz/trace-cmd