[PATCH 1/1] mtd: ubi: skip programming unused bits in ubi headers
Miquel Raynal
miquel.raynal at bootlin.com
Fri Nov 7 00:23:29 PST 2025
Hello,
>> > + if (ubi->vid_hdr_shift)
>> > + memset((char *)p, 0xFF, ubi->vid_hdr_alsize - UBI_VID_HDR_SIZE);
>> > + else
>> > + memset((char *)p + UBI_VID_HDR_SIZE, 0xFF, ubi->vid_hdr_alsize - UBI_VID_HDR_SIZE);
>>
>> Here I am reaching the limits of my UBI knowledge, so I would prefer
>> Richard to (in)validate what I am saying, but AFAIU, the VID header can
>> be literally anywhere in the page, not just at the start or end of a
>> subpage, so in the vid_hdr_shift I would expect some extra maths to
>> happen, no?
>
> I understand your point now. If the VID header is not guaranteed to be
> at the start or end of a subpage, then yes, my current logic needs to be
> reworked to cover that case.
I don't know if this is easy to do, but maybe you can memset the whole
buffer before filling it. That would avoid the need to know where the
VID header will be.
Thanks,
Miquèl
More information about the linux-mtd
mailing list