Re: [PATCH v2 1/1] mtd: ubi: skip programming unused bits in ubi headers

From: Miquel Raynal

Date: Fri Nov 14 2025 - 03:31:54 EST


Hi Cheng Ming,

> @@ -1150,6 +1152,14 @@ int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum,
> return -EROFS;
> }
>
> + if (ubi->vid_hdr_shift) {
> + memset((char *)p, 0xFF, ubi->vid_hdr_shift);
> + memset((char *)p + ubi->vid_hdr_shift + UBI_VID_HDR_SIZE, 0xFF,
> + ubi->vid_hdr_alsize - (ubi->vid_hdr_shift + UBI_VID_HDR_SIZE));
> + } else {
> + memset((char *)p + UBI_VID_HDR_SIZE, 0xFF, ubi->vid_hdr_alsize - UBI_VID_HDR_SIZE);
> + }
> +

Is it not possible to memset() the buffer before writing the VID header?
I haven't found quickly a good place to do that, so in any case,

Reviewed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>

Thanks,
Miquèl