{"id":833280,"url":"http://patchwork.ozlabs.org/api/1.2/patches/833280/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1509612394-24359-1-git-send-email-shawnguo@kernel.org/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1509612394-24359-1-git-send-email-shawnguo@kernel.org>","list_archive_url":null,"date":"2017-11-02T08:46:34","name":"[U-Boot] disk: part_dos: fix part_get_info_extended() function","commit_ref":"8f7102cf6bf744cbd9bf0e7fd79a82aaea989f81","pull_url":null,"state":"accepted","archived":false,"hash":"27dd2a3aeeb1855f1aaf4a708754e5b18a569863","submitter":{"id":66396,"url":"http://patchwork.ozlabs.org/api/1.2/people/66396/?format=json","name":"Shawn Guo","email":"shawnguo@kernel.org"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.2/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1509612394-24359-1-git-send-email-shawnguo@kernel.org/mbox/","series":[{"id":11471,"url":"http://patchwork.ozlabs.org/api/1.2/series/11471/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=11471","date":"2017-11-02T08:46:34","name":"[U-Boot] disk: part_dos: fix part_get_info_extended() function","version":1,"mbox":"http://patchwork.ozlabs.org/series/11471/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/833280/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/833280/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","mail.kernel.org;\n\tdmarc=none (p=none dis=none) header.from=kernel.org","mail.kernel.org;\n\tspf=none smtp.mailfrom=shawnguo@kernel.org"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3ySM1J4Xstz9t3H\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  2 Nov 2017 21:35:29 +1100 (AEDT)","by lists.denx.de (Postfix, from userid 105)\n\tid 2E809C21D93; Thu,  2 Nov 2017 10:35:22 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id C8A92C21C29;\n\tThu,  2 Nov 2017 10:35:18 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid D3DDEC21C26; Thu,  2 Nov 2017 08:46:45 +0000 (UTC)","from mail.kernel.org (mail.kernel.org [198.145.29.99])\n\tby lists.denx.de (Postfix) with ESMTPS id B862FC21C29\n\tfor <u-boot@lists.denx.de>; Thu,  2 Nov 2017 08:46:42 +0000 (UTC)","from localhost.localdomain (unknown [45.56.152.162])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby mail.kernel.org (Postfix) with ESMTPSA id 52FA2218D2;\n\tThu,  2 Nov 2017 08:46:38 +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\n\tautolearn_force=no version=3.4.0","DMARC-Filter":"OpenDMARC Filter v1.3.2 mail.kernel.org 52FA2218D2","From":"Shawn Guo <shawnguo@kernel.org>","To":"Alexander Graf <agraf@suse.de>","Date":"Thu,  2 Nov 2017 16:46:34 +0800","Message-Id":"<1509612394-24359-1-git-send-email-shawnguo@kernel.org>","X-Mailer":"git-send-email 1.9.1","X-Mailman-Approved-At":"Thu, 02 Nov 2017 10:35:17 +0000","Cc":"Andre Przywara <andre.przywara@arm.com>, u-boot@lists.denx.de,\n\tPeter Jones <pjones@redhat.com>, project-aspen-dev@linaro.org","Subject":"[U-Boot] [PATCH] disk: part_dos: fix part_get_info_extended()\n\tfunction","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"From: Shawn Guo <shawn.guo@linaro.org>\n\nThe check in part_get_info_extended() for a successful partition\nsearching misses a condition for extended partition. In case of\n(ext_part_sector == 0), we should anyway mark the partition as found,\neven if it's an extended partition, i.e. (is_extended(pt->sys_ind) == 0).\nOtherwise, the extended partition (type 0x0f) will never be identified,\nand the following recursive call to part_get_info_extended() will get a\nwrong 'part_num' and 'which_part' parameter.  In the end, all those\npartitions in extended table will not be identified.\n\nLet's add the missing OR condition of (ext_part_sector == 0) for\nis_extended() check to fix the problem.\n\nThe issue is discovered by running fastboot flash to an extended\npartition on eMMC.\n\n  $ fastboot flash mmcsda5 cache.img\n  target reported max download size of 536870912 bytes\n  sending 'mmcsda5' (18796 KB)...\n  OKAY [  2.144s]\n  writing 'mmcsda5'...\n  FAILED (remote: cannot find partition)\n  finished. total time: 2.261s\n\nSigned-off-by: Shawn Guo <shawn.guo@linaro.org>\n---\n disk/part_dos.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/disk/part_dos.c b/disk/part_dos.c\nindex 1a36be0446ac..4485eb704852 100644\n--- a/disk/part_dos.c\n+++ b/disk/part_dos.c\n@@ -210,7 +210,7 @@ static int part_get_info_extended(struct blk_desc *dev_desc,\n \t\tif (((pt->boot_ind & ~0x80) == 0) &&\n \t\t    (pt->sys_ind != 0) &&\n \t\t    (part_num == which_part) &&\n-\t\t    (is_extended(pt->sys_ind) == 0)) {\n+\t\t    (ext_part_sector == 0 || is_extended(pt->sys_ind) == 0)) {\n \t\t\tinfo->blksz = DOS_PART_DEFAULT_SECTOR;\n \t\t\tinfo->start = (lbaint_t)(ext_part_sector +\n \t\t\t\t\tle32_to_int(pt->start4));\n","prefixes":["U-Boot"]}