pstore: Warn on PSTORE_TYPE_PMSG using deprecated function
authorJoel Fernandes <joelaf@google.com>
Thu, 20 Oct 2016 07:34:02 +0000 (00:34 -0700)
committerKees Cook <keescook@chromium.org>
Fri, 11 Nov 2016 18:36:46 +0000 (10:36 -0800)
PMSG now uses ramoops_pstore_write_buf_user() instead of ...write_buf().
Print a ratelimited warning if gets accidentally called.

Signed-off-by: Joel Fernandes <joelaf@google.com>
[kees: adjusted commit log and added -EINVAL return]
Signed-off-by: Kees Cook <keescook@chromium.org>
fs/pstore/ram.c

index 6ad831b9d1b87a5effb234bb71c9d43d8197d5d0..6d1393965b0a1e34a4880687508f531093a86f6a 100644 (file)
@@ -288,10 +288,8 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
                persistent_ram_write(cxt->fprz, buf, size);
                return 0;
        } else if (type == PSTORE_TYPE_PMSG) {
-               if (!cxt->mprz)
-                       return -ENOMEM;
-               persistent_ram_write(cxt->mprz, buf, size);
-               return 0;
+               pr_warn_ratelimited("PMSG shouldn't call %s\n", __func__);
+               return -EINVAL;
        }
 
        if (type != PSTORE_TYPE_DMESG)