Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965344AbcKKW2F (ORCPT ); Fri, 11 Nov 2016 17:28:05 -0500 Received: from mail-pf0-f169.google.com ([209.85.192.169]:36863 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937926AbcKKW2C (ORCPT ); Fri, 11 Nov 2016 17:28:02 -0500 From: Kees Cook To: Joel Fernandes Cc: Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck , linux-kernel@vger.kernel.org Subject: [PATCH v3 2/8] pstore: Warn on PSTORE_TYPE_PMSG using deprecated function Date: Fri, 11 Nov 2016 14:21:47 -0800 Message-Id: <1478902913-143778-3-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478902913-143778-1-git-send-email-keescook@chromium.org> References: <1478902913-143778-1-git-send-email-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 959 Lines: 31 From: Joel Fernandes 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 [kees: adjusted commit log and added -EINVAL return] Signed-off-by: Kees Cook --- fs/pstore/ram.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 6ad831b9d1b8..6d1393965b0a 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -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) -- 2.7.4