lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAyq3SYtJOZFwSY-UBfd+SwsSBV_1SPBMACCi1JCoCV-khVe6w@mail.gmail.com>
Date: Fri, 14 Nov 2025 16:47:46 +0800
From: Cheng Ming Lin <linchengming884@...il.com>
To: Miquel Raynal <miquel.raynal@...tlin.com>
Cc: richard@....at, chengzhihao1@...wei.com, vigneshr@...com, 
	linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org, 
	alvinzhou@...c.com.tw, leoyu@...c.com.tw, 
	Cheng Ming Lin <chengminglin@...c.com.tw>
Subject: Re: [PATCH v2 1/1] mtd: ubi: skip programming unused bits in ubi headers

Hi Miquel,

Miquel Raynal <miquel.raynal@...tlin.com> 於 2025年11月14日 週五 下午4:31寫道:
>
> 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,

If we want to memset() the buffer before writing the VID header, one
possible option is to modify ubi_init_vid_buf() in
drivers/mtd/ubi/ubi.h.

Specifically, we could replace the existing
memset(buf, 0, ubi->vid_hdr_alsize) inside the "if (buf)" block with
memset(buf, 0xff, ubi->vid_hdr_alsize). After the VID header
position has been determined, we can then apply a second memset() on
vidh->hdr to zero-initialize UBI_VID_HDR_SIZE. This approach should
provide the same effect while ensuring that all fields inside the VID
header are properly initialized to zero.

Does this make sense to you? If this direction is preferable, I can
prepare a v3 reflecting this change, and I will also run ubi-tests to
verify the behavior. Thanks!

>
> Reviewed-by: Miquel Raynal <miquel.raynal@...tlin.com>
>
> Thanks,
> Miquèl

Thanks,
Cheng Ming Lin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ