From patchwork Wed Sep 4 09:22:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faiz Abbas X-Patchwork-Id: 1157558 X-Patchwork-Delegate: alexey.brodkin@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=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="bWx+z6qi"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46Ndcg2Fmfz9s3Z for ; Wed, 4 Sep 2019 19:21:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 63176C21EA1; Wed, 4 Sep 2019 09:21:50 +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=T_DKIM_INVALID 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 3DFCAC21C2F; Wed, 4 Sep 2019 09:21:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CB66EC21C2F; Wed, 4 Sep 2019 09:21:47 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id 3EADBC21C29 for ; Wed, 4 Sep 2019 09:21:47 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x849Lhv5038686; Wed, 4 Sep 2019 04:21:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1567588903; bh=tgnoPz66ncN/EsRowqEsqz6V1eYNusxx4JrewgwQZ8Q=; h=From:To:CC:Subject:Date; b=bWx+z6qi/hocudr8dXBxdHne2ZXmUJxREVLvj/vYDoXa4on9fpxzFOCifK/Mu0Dew UZUMyNA32UDzGPcSXxoO4xC3mUHNDm3RZOAxiSeOuH26uLHNq3eyXateSBxq0xmETC 4Q1EPTOuK0UTHzlquiSc/TqOvBwEx0KtZuJeDD+0= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x849LhCw100220 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 4 Sep 2019 04:21:43 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 4 Sep 2019 04:21:43 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 4 Sep 2019 04:21:43 -0500 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x849LeEQ000821; Wed, 4 Sep 2019 04:21:41 -0500 From: Faiz Abbas To: Date: Wed, 4 Sep 2019 14:52:19 +0530 Message-ID: <20190904092219.6045-1-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Alexey.Brodkin@synopsys.com, trini@konsulko.com Subject: [U-Boot] [PATCH] Revert "part: Allocate only one legacy_mbr buffer" 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" This reverts commit 8639e34d2c5e12cc2e45c95b1a2e97c22bf6a711. The blk_dread() call following the allocation will read one block from the device. This will lead to overflow if the blocksize is greater than the size of legacy_mbr. Fix this by allocating one block size. Signed-off-by: Faiz Abbas --- disk/part_dos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk/part_dos.c b/disk/part_dos.c index aae9d95906..24d23ad247 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c @@ -93,7 +93,7 @@ static int test_block_type(unsigned char *buffer) static int part_test_dos(struct blk_desc *dev_desc) { #ifndef CONFIG_SPL_BUILD - ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, 1); + ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, dev_desc->blksz); if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1) return -1;