From patchwork Mon Jan 29 19:58:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 867273 X-Patchwork-Delegate: trini@ti.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 3zVgLW6C52z9ryT for ; Tue, 30 Jan 2018 06:58:42 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id D52EDC21E28; Mon, 29 Jan 2018 19:58:36 +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=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL 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 59AFEC21C51; Mon, 29 Jan 2018 19:58:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CE56CC21C51; Mon, 29 Jan 2018 19:58:31 +0000 (UTC) Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com [198.182.60.111]) by lists.denx.de (Postfix) with ESMTPS id 2A217C21C29 for ; Mon, 29 Jan 2018 19:58:31 +0000 (UTC) Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id EB0AD10C06F1; Mon, 29 Jan 2018 11:58:28 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id D42B9BD4; Mon, 29 Jan 2018 11:58:28 -0800 (PST) Received: from abrodkin-7480l.internal.synopsys.com (unknown [10.121.8.86]) by mailhost.synopsys.com (Postfix) with ESMTP id 0DA8BBCA; Mon, 29 Jan 2018 11:58:26 -0800 (PST) From: Alexey Brodkin To: u-boot@lists.denx.de Date: Mon, 29 Jan 2018 22:58:24 +0300 Message-Id: <20180129195824.737-1-abrodkin@synopsys.com> X-Mailer: git-send-email 2.14.3 Cc: Peter Jones , Tom Rini , Alexey Brodkin , Alexander Graf Subject: [U-Boot] [PATCH] 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Commit ff98cb90514d ("part: extract MBR signature from partitions") blindly switched allocated by ALLOC_CACHE_ALIGN_BUFFER buffer type from "unsigned char" to "legacy_mbr" which caused allocation of size = (typeof(legacy_mbr) * dev_desc->blksize) instead of just space enough for "legacy_mbr" structure. Signed-off-by: Alexey Brodkin Cc: Rob Clark Cc: Peter Jones Cc: Alexander Graf Cc: Tom Rini --- 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 046f9bbb3d69..9dd086d3db06 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c @@ -90,7 +90,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, dev_desc->blksz); + ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, 1); if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1) return -1;