PRINTK_PERSIST: fix buffer mangling bugs.

There were two problems here:

1) The header validation was slightly incorrect, so if a lot of data had
   been written to the buffer, it would be guaranteed to be discarded next
   time you rebooted.  The net effect is that kernel panics after a certain
   amount of time (about 2MB of log) would never actually be logged.

2) If you rebooted after exactly the wrong amount of log data had been
   written (between 1MB and 2MB) would cause memory corruption.  Actually
   there would be memory corruption for any amount >= the ring buffer size,
   except that bug #1 discarded the buffer entirely if it was 2*bufsize,
   protecting us most of the time.  This is almost certainly the cause of
   the occasional "recursive printk" log messages.

Change-Id: I626f383488b08e30d9c032c79fa79ad0d418a344
1 file changed