Hi Reuben, On Thu, Feb 03, 2011 at 08:27:47AM +1300, Reuben Dowle wrote: > I think this updated patch addresses the comments from Baruch.
Thanks. One more comment below. Other than that, Acked-by: Baruch Siach <[email protected]> > Cut down version of ubimkvol, ubirmvol and ubirsvol. Does not support > deleting or resizing named volumes (must use volume id), and does not > support specifying size as anything other than a byte count. > > Signed-off-by: Reuben Dowle <reuben.dowle at navico.com> > --- > miscutils/ubi_attach_detach.c | 127 +++++++++++++++++++++++++++++++++++++---- > 1 files changed, 115 insertions(+), 12 deletions(-) > > diff --git a/miscutils/ubi_attach_detach.c b/miscutils/ubi_attach_detach.c [snip] > + } else if (do_mkvol) { > + struct ubi_mkvol_req req; > + if (!(opts & OPTION_s)) > + bb_error_msg_and_die("%s size not specified", "UBI"); > + if (!(opts & OPTION_N)) > + bb_error_msg_and_die("%s name not specified", "UBI"); > + > + memset(&req, 0, sizeof(req)); > + req.vol_id = vol_id; > + if (opts & OPTION_t) { > + if (type[0] == 's') > + req.vol_type = UBI_STATIC_VOLUME; > + else > + req.vol_type = UBI_DYNAMIC_VOLUME; > + } else > + req.vol_type = UBI_DYNAMIC_VOLUME; > + req.alignment = alignment; > + req.bytes = size_bytes; > + strcpy(req.name, vol_name); This may overflow req.name. Instead, do: strncpy(req.name, vol_name, UBI_MAX_VOLUME_NAME); > + req.name_len = strlen(req.name); > + > + xioctl(fd, UBI_IOCMKVOL, &req); > + } else if (do_rmvol) { > + if (!(opts & OPTION_n)) > + bb_error_msg_and_die("%s volume id not specified", > "UBI"); > + > + xioctl(fd, UBI_IOCRMVOL, &vol_id); > + } else if (do_rsvol) { > + struct ubi_rsvol_req req; > + if (!(opts & OPTION_s)) > + bb_error_msg_and_die("%s size not specified", "UBI"); > + if (!(opts & OPTION_n)) > + bb_error_msg_and_die("%s volume id not specified", > "UBI"); > + > + memset(&req, 0, sizeof(req)); > + req.bytes = size_bytes; > + req.vol_id = vol_id; > + > + xioctl(fd, UBI_IOCRSVOL, &req); > } > > if (ENABLE_FEATURE_CLEAN_UP) -- ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il - _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
