From: Tom Rini Date: Wed, 18 Oct 2017 12:27:38 -0400 Subject: [U-Boot] [PATCH] cmd: usb_mass_storage: add protection for block_dev In-Reply-To: <1508335401-13198-1-git-send-email-patrick.delaunay@st.com> References: <1508335401-13198-1-git-send-email-patrick.delaunay@st.com> Message-ID: <20171018162738.GM12015@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Oct 18, 2017 at 04:03:21PM +0200, Patrick Delaunay wrote: > solve data abort for the command "ums 0 ubi 0" > because result of case blk_get_device_part_str() result is OK > but with block_dev = 0 when CONFIG_CMD_UBIFS is activate and > ubi volume is mounted > > Signed-off-by: Patrick Delaunay > --- > > cmd/usb_mass_storage.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c > index cfeecb7..c0563ca 100644 > --- a/cmd/usb_mass_storage.c > +++ b/cmd/usb_mass_storage.c > @@ -85,7 +85,7 @@ static int ums_init(const char *devtype, const char *devnums_part_str) > partnum = 0; > > /* f_mass_storage.c assumes SECTOR_SIZE sectors */ > - if (block_dev->blksz != SECTOR_SIZE) > + if (!block_dev || block_dev->blksz != SECTOR_SIZE) > goto cleanup; > > ums_new = realloc(ums, (ums_count + 1) * sizeof(*ums)); Adding in Marek.. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: