Messages in this thread | ![/](/images/icornerl.gif) | | Date | Sat, 4 Mar 2023 18:11:10 +0100 (CET) | From | Richard Weinberger <> | Subject | Re: [PATCH v2] ubi: Fix failure attaching when vid_hdr offset equals to (sub)page size |
| |
----- Ursprüngliche Mail ----- > Von: "chengzhihao1" <chengzhihao1@huawei.com> > + /* > + * Memory allocation for VID header is ubi->vid_hdr_alsize > + * which is described in comments in io.c. > + * Make sure VID header shift + UBI_VID_HDR_SIZE not exceeds > + * ubi->vid_hdr_alsize, so that all vid header operations > + * won't access memory out of bounds. > + */ > + if ((ubi->vid_hdr_shift + UBI_VID_HDR_SIZE) > ubi->vid_hdr_alsize) { > + ubi_err(ubi, "Invalid VID header offset %d, VID header shift(%d)" > + " + VID header size(%d) > VID header aligned size(%d).", > + ubi->vid_hdr_offset, ubi->vid_hdr_shift, > + (int)UBI_VID_HDR_SIZE, ubi->vid_hdr_alsize);
Hmm, why are you casting to int instead of using %zu as format string?
Thanks, //richard
| ![\](/images/icornerr.gif) |