Header size is needed to distinguish between header and the dump data.
Incorporate the addition of new argument (hsize) in the pstore write
callback.
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  * @part:               pstore writes data to registered buffer in parts,
  *                      part number will indicate the same.
  * @count:              Indicates oops count
+ * @hsize:              Size of header added by pstore
  * @size:               number of bytes written to the registered buffer
  * @psi:                registered pstore_info structure
  *
 static int nvram_pstore_write(enum pstore_type_id type,
                                enum kmsg_dump_reason reason,
                                u64 *id, unsigned int part, int count,
-                               size_t size, struct pstore_info *psi)
+                               size_t hsize, size_t size,
+                               struct pstore_info *psi)
 {
        int rc;
        struct oops_log_info *oops_hdr = (struct oops_log_info *) oops_buf;
 
                           struct timespec *time, char **buf,
                           struct pstore_info *psi);
 static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
-                      u64 *id, unsigned int part, int count,
+                      u64 *id, unsigned int part, int count, size_t hsize,
                       size_t size, struct pstore_info *psi);
 static int erst_clearer(enum pstore_type_id type, u64 id, int count,
                        struct timespec time, struct pstore_info *psi);
 }
 
 static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
-                      u64 *id, unsigned int part, int count,
+                      u64 *id, unsigned int part, int count, size_t hsize,
                       size_t size, struct pstore_info *psi)
 {
        struct cper_pstore_record *rcd = (struct cper_pstore_record *)
 
 
 static int efi_pstore_write(enum pstore_type_id type,
                enum kmsg_dump_reason reason, u64 *id,
-               unsigned int part, int count, size_t size,
+               unsigned int part, int count, size_t hsize, size_t size,
                struct pstore_info *psi)
 {
        char name[DUMP_NAME_LEN];
 
                        break;
 
                ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part,
-                                   oopscount, hsize + len, psinfo);
+                                   oopscount, hsize, hsize + len, psinfo);
                if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
                        pstore_new_entry = 1;
 
                        spin_lock_irqsave(&psinfo->buf_lock, flags);
                }
                memcpy(psinfo->buf, s, c);
-               psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, c, psinfo);
+               psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, 0, c, psinfo);
                spin_unlock_irqrestore(&psinfo->buf_lock, flags);
                s += c;
                c = e - s;
 static int pstore_write_compat(enum pstore_type_id type,
                               enum kmsg_dump_reason reason,
                               u64 *id, unsigned int part, int count,
-                              size_t size, struct pstore_info *psi)
+                              size_t hsize, size_t size,
+                              struct pstore_info *psi)
 {
-       return psi->write_buf(type, reason, id, part, psinfo->buf, size, psi);
+       return psi->write_buf(type, reason, id, part, psinfo->buf, hsize,
+                            size, psi);
 }
 
 /*
 
 static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
                                            enum kmsg_dump_reason reason,
                                            u64 *id, unsigned int part,
-                                           const char *buf, size_t size,
+                                           const char *buf,
+                                           size_t hsize, size_t size,
                                            struct pstore_info *psi)
 {
        struct ramoops_context *cxt = psi->data;
 
                        struct pstore_info *psi);
        int             (*write)(enum pstore_type_id type,
                        enum kmsg_dump_reason reason, u64 *id,
-                       unsigned int part, int count, size_t size,
-                       struct pstore_info *psi);
+                       unsigned int part, int count, size_t hsize,
+                       size_t size, struct pstore_info *psi);
        int             (*write_buf)(enum pstore_type_id type,
                        enum kmsg_dump_reason reason, u64 *id,
-                       unsigned int part, const char *buf, size_t size,
-                       struct pstore_info *psi);
+                       unsigned int part, const char *buf, size_t hsize,
+                       size_t size, struct pstore_info *psi);
        int             (*erase)(enum pstore_type_id type, u64 id,
                        int count, struct timespec time,
                        struct pstore_info *psi);