diff -drupN a/fs/pstore/pmsg.c b/fs/pstore/pmsg.c --- a/fs/pstore/pmsg.c 2018-08-06 17:23:04.000000000 +0300 +++ b/fs/pstore/pmsg.c 2022-06-12 05:28:14.000000000 +0300 @@ -15,7 +15,6 @@ #include #include #include -#include #include "internal.h" static DEFINE_MUTEX(pmsg_lock); @@ -23,19 +22,22 @@ static DEFINE_MUTEX(pmsg_lock); static ssize_t write_pmsg(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { - u64 id; + struct pstore_record record; int ret; if (!count) return 0; - /* check outside lock, page in any data. write_buf_user also checks */ + pstore_record_init(&record, psinfo); + record.type = PSTORE_TYPE_PMSG; + record.size = count; + + /* check outside lock, page in any data. write_user also checks */ if (!access_ok(VERIFY_READ, buf, count)) return -EFAULT; mutex_lock(&pmsg_lock); - ret = psinfo->write_buf_user(PSTORE_TYPE_PMSG, 0, &id, 0, buf, 0, count, - psinfo); + ret = psinfo->write_user(&record, buf); mutex_unlock(&pmsg_lock); return ret ? ret : count; }