public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Joel Fernandes <joelaf@google.com>
Cc: Vasily Averin <vvs@virtuozzo.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH v2] pstore: pstore_ftrace_seq_next should increase position index
Date: Wed, 26 Feb 2020 10:40:47 -0800	[thread overview]
Message-ID: <202002261040.8F21715C@keescook> (raw)
In-Reply-To: <CAJWu+oqZ+=Z1x0+Xm46Y90w=+dhub6dm+s=nU2-V9QeDn5AcrQ@mail.gmail.com>

On Wed, Feb 26, 2020 at 01:36:45PM -0500, Joel Fernandes wrote:
> One thing I was not sure about is, if we move "pos" forward but still
> return NULL from next(), then does show() need to check if data is
> NULL? As below. Otherwise the suggested patch looks sane to me.
> 
> diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
> index 7fbe8f0582205..e3e7370b1a34d 100644
> --- a/fs/pstore/inode.c
> +++ b/fs/pstore/inode.c
> @@ -101,6 +101,9 @@ static int pstore_ftrace_seq_show(struct seq_file
> *s, void *v)
>         struct pstore_ftrace_seq_data *data = v;
>         struct pstore_ftrace_record *rec;
> 
> +       if (!data)
> +               return 0;
> +
>         rec = (struct pstore_ftrace_record *)(ps->record->buf + data->off);
> 
>         seq_printf(s, "CPU:%d ts:%llu %08lx  %08lx  %ps <- %pS\n",

Ah, good point. I'm not sure, but it's worth checking I think. :)

-- 
Kees Cook

  reply	other threads:[~2020-02-26 18:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25  8:11 [PATCH v2] pstore: pstore_ftrace_seq_next should increase position index Vasily Averin
2020-02-25 19:39 ` Kees Cook
2020-02-26 18:36   ` Joel Fernandes
2020-02-26 18:40     ` Kees Cook [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-02-25  8:11 Vasily Averin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202002261040.8F21715C@keescook \
    --to=keescook@chromium.org \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=joelaf@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=vvs@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox