mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Nicolas Schichan <nschichan@freebox.fr>
Cc: <george.kennedy@oracle.com>, <linux-kernel@vger.kernel.org>,
	<linux-mtd@lists.infradead.org>, <miquel.raynal@bootlin.com>,
	<richard@nod.at>, <s.hauer@pengutronix.de>, <yi.zhang@huawei.com>
Subject: Re: [PATCH -next v3] ubi: Fix failure attaching when vid_hdr offset equals to (sub)page size
Date: Sat, 25 Mar 2023 09:02:40 +0800	[thread overview]
Message-ID: <2c2c2ce9-795b-4f76-cde9-db4a4066dcc1@huawei.com> (raw)
In-Reply-To: <20230324161923.1456371-1-nschichan@freebox.fr>

Hi,
> 
>> Following process will make ubi attaching failed since commit
>> 1b42b1a36fc946 ("ubi: ensure that VID header offset ... size"):
>>
>> ID="0xec,0xa1,0x00,0x15" # 128M 128KB 2KB
>> modprobe nandsim id_bytes=$ID
>> flash_eraseall /dev/mtd0
>> modprobe ubi mtd="0,2048"  # set vid_hdr offset as 2048 (one page)
>> (dmesg):
>>    ubi0 error: ubi_attach_mtd_dev [ubi]: VID header offset 2048 too large.
>>    UBI error: cannot attach mtd0
>>    UBI error: cannot initialize UBI, error -22
>>
>> Rework original solution, the key point is making sure
>> 'vid_hdr_shift + UBI_VID_HDR_SIZE < ubi->vid_hdr_alsize',
>> so we should check vid_hdr_shift rather not vid_hdr_offset.
>> Then, ubi still support (sub)page aligined VID header offset.
>>
>> Fixes: 1b42b1a36fc946 ("ubi: ensure that VID header offset ... size")
>> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
>> ---
>>   v2->v3: Use printing format '%zu' for UBI_VID_HDR_SIZE.
>>   drivers/mtd/ubi/build.c | 21 +++++++++++++++------
>>   1 file changed, 15 insertions(+), 6 deletions(-)
> 
> [...]
> 
> Hello,
> 
> Having had the problem, and found this patch as a fix, feel free to
> add my:
> 

Thanks for testing.

> Tested-by: Nicolas Schichan <nschichan@freebox.fr>
> 


  reply	other threads:[~2023-03-25  1:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06  1:33 Zhihao Cheng
2023-03-24 16:19 ` Nicolas Schichan
2023-03-25  1:02   ` Zhihao Cheng [this message]
2023-03-29 15:54     ` Miquel Raynal
2023-03-29 21:33       ` Richard Weinberger
2023-04-14 23:12         ` Daniel Golle
2023-04-15 18:25           ` Richard Weinberger

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=2c2c2ce9-795b-4f76-cde9-db4a4066dcc1@huawei.com \
    --to=chengzhihao1@huawei.com \
    --cc=george.kennedy@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=nschichan@freebox.fr \
    --cc=richard@nod.at \
    --cc=s.hauer@pengutronix.de \
    --cc=yi.zhang@huawei.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

all inboxes | Powered by JetHome®