pstore: Create common record initializer

In preparation for setting timestamps in the pstore core, create a common
initializer routine, instead of using static initializers.

Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
Kees Cook
2017-05-19 15:10:31 -07:00
bovenliggende efb74e4bb1
commit e581ca813a
3 gewijzigde bestanden met toevoegingen van 28 en 19 verwijderingen

Bestand weergeven

@@ -22,16 +22,16 @@ static DEFINE_MUTEX(pmsg_lock);
static ssize_t write_pmsg(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct pstore_record record = {
.type = PSTORE_TYPE_PMSG,
.size = count,
.psi = psinfo,
};
struct pstore_record record;
int ret;
if (!count)
return 0;
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;