From patchwork Wed Oct 18 14:03:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 827610 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yHDLM3RNhz9t3l for ; Thu, 19 Oct 2017 01:03:37 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id B9D81C21EBD; Wed, 18 Oct 2017 14:03:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id F3501C21E66; Wed, 18 Oct 2017 14:03:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BE581C21E66; Wed, 18 Oct 2017 14:03:26 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id 1EA63C21E10 for ; Wed, 18 Oct 2017 14:03:26 +0000 (UTC) Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9IDsM9n001166; Wed, 18 Oct 2017 16:03:25 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2dmvkun2v4-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 18 Oct 2017 16:03:25 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7B67534; Wed, 18 Oct 2017 14:03:24 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 635BE2787; Wed, 18 Oct 2017 14:03:24 +0000 (GMT) Received: from SAFEX1HUBCAS21.st.com (10.75.90.44) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 18 Oct 2017 16:03:24 +0200 Received: from localhost (10.201.23.85) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 18 Oct 2017 16:03:23 +0200 From: Patrick Delaunay To: Date: Wed, 18 Oct 2017 16:03:21 +0200 Message-ID: <1508335401-13198-1-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-18_05:, , signatures=0 Cc: Fabio Estevam Subject: [U-Boot] [PATCH] cmd: usb_mass_storage: add protection for block_dev X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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));