linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Marc Eurin <jmeurin@google.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mtdoops: Fix the size of the header read buffer.
Date: Thu, 3 Feb 2022 17:53:47 -0800	[thread overview]
Message-ID: <CAL3wywWSDJUsbgJf4NXctxJmrJRzyO9V-PVcu3qftM1GGPyU_Q@mail.gmail.com> (raw)
In-Reply-To: <20220131110003.7aacad70@xps13>

On Mon, Jan 31, 2022 at 2:00 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Hi Jean-Marc,
>
> jmeurin@google.com wrote on Fri, 28 Jan 2022 14:01:56 -0800:
>
> > The read buffer size depends on the MTDOOPS_HEADER_SIZE.
> >
> > Tested: Changed the header size, it doesn't panic, header is still
> > read/written correctly.
>
> On what Linux kernel version are you? It looks like we don't share the
> same code base, are we?

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mtd/mtdoops.c?h=v5.17-rc2
has that bug.  If you try to increase the MTDOOPS_HEADER_SIZE,
find_next_position() will try to do an mtd_read() of
MTDOOPS_HEADER_SIZE bytes in a count buffer that is fixed to only 8
bytes.

Thanks,

Jean-Marc

>
> >
> > Signed-off-by: Jean-Marc Eurin <jmeurin@google.com>
> > ---
> >  drivers/mtd/mtdoops.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
> > index 227df24387df..09a26747f490 100644
> > --- a/drivers/mtd/mtdoops.c
> > +++ b/drivers/mtd/mtdoops.c
> > @@ -223,7 +223,7 @@ static void find_next_position(struct mtdoops_context *cxt)
> >  {
> >       struct mtd_info *mtd = cxt->mtd;
> >       int ret, page, maxpos = 0;
> > -     u32 count[2], maxcount = 0xffffffff;
> > +     u32 count[MTDOOPS_HEADER_SIZE/sizeof(u32)], maxcount = 0xffffffff;
> >       size_t retlen;
> >
> >       for (page = 0; page < cxt->oops_pages; page++) {
>
>
> Thanks,
> Miquèl

  reply	other threads:[~2022-02-04  1:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 22:01 [PATCH] Fix the size of the header read buffer Jean-Marc Eurin
2022-01-31 10:00 ` Miquel Raynal
2022-02-04  1:53   ` Jean-Marc Eurin [this message]
2022-02-07 15:34     ` [PATCH v2] mtdoops: " Miquel Raynal
2022-03-30 18:28       ` [PATCH] " Jean-Marc Eurin
2022-03-30 18:28         ` [PATCH v2 0/2] mtd: mtdoops: Structure the header of the dumped oops Jean-Marc Eurin
2022-03-30 18:28         ` [PATCH v2 1/2] mtd: mtdoops: Fix the size of the header read buffer Jean-Marc Eurin
2022-03-30 18:28         ` [PATCH v2 2/2] mtd: mtdoops: Create a header structure for the saved mtdoops Jean-Marc Eurin
2022-03-30 22:23           ` kernel test robot
2022-03-31  0:14           ` kernel test robot
2022-03-30 19:59         ` [PATCH] Fix the size of the header read buffer Jean-Marc Eurin
2022-04-15  0:13       ` [PATCH v3 0/3] mtd: mtdoops: Add timestamp to the dumped oops header Jean-Marc Eurin
2022-04-15  0:13         ` [PATCH v3 1/3] mtd: mtdoops: Fix the size of the header read buffer Jean-Marc Eurin
2022-04-21  7:35           ` Miquel Raynal
2022-04-15  0:13         ` [PATCH v3 2/3] mtd: mtdoops: Create a header structure for the saved mtdoops Jean-Marc Eurin
2022-04-21  7:35           ` Miquel Raynal
2022-04-15  0:13         ` [PATCH v3 3/3] mtd: mtdoops: Add a timestamp to the mtdoops header Jean-Marc Eurin
2022-04-21  7:35           ` Miquel Raynal
2022-04-21 23:42         ` [PATCH v4 0/3] mtd: mtdoops: Add timestamp to the dumped oops header Jean-Marc Eurin
2022-04-21 23:42           ` [PATCH v4 1/3] mtd: mtdoops: Fix the size of the header read buffer Jean-Marc Eurin
2022-04-26  7:34             ` Miquel Raynal
2022-04-21 23:42           ` [PATCH v4 2/3] mtd: mtdoops: Create a header structure for the saved mtdoops Jean-Marc Eurin
2022-04-26  7:34             ` Miquel Raynal
2022-04-25  8:42           ` [PATCH v4 0/3] mtd: mtdoops: Add timestamp to the dumped oops header Miquel Raynal
2022-04-25 16:14             ` Jean-Marc Eurin
2022-04-26  7:28               ` Miquel Raynal
2022-04-25 16:09         ` [PATCH v4 3/3] mtd: mtdoops: Add a timestamp to the mtdoops header Jean-Marc Eurin
2022-04-26  7:34           ` Miquel Raynal

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=CAL3wywWSDJUsbgJf4NXctxJmrJRzyO9V-PVcu3qftM1GGPyU_Q@mail.gmail.com \
    --to=jmeurin@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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;
as well as URLs for NNTP newsgroup(s).