]> git.dujemihanovic.xyz Git - u-boot.git/commit
part: Check all partitions in part_get_info_by_name()
authorSam Protsenko <semen.protsenko@linaro.org>
Thu, 28 Mar 2024 22:29:50 +0000 (17:29 -0500)
committerTom Rini <trini@konsulko.com>
Fri, 12 Apr 2024 14:53:31 +0000 (08:53 -0600)
commitac0cd5267f1ba6a3cb1daf42b9c6230037cb0414
treec09d1c5329aa5ddf5babc2421cd32dddfe189666
parent55a7d60f8f10b1c3c5a8e29571c065d61f5dd12f
part: Check all partitions in part_get_info_by_name()

In part_get_info_by_name() the inability to get some partition info
shouldn't be a reason for dropping out of the loop. That might happen
e.g. if the partition is hidden or unused. An example of such case are
Samsung devices, where they use the "unused" GUID type
(00000000-0000-0000-0000-000000000000) to indicate that the partition
should be hidden from the OS. Such partitions might not be seen in
"part list" output, which creates "gaps" in numbering in between of the
visible partitions:

    Part    Start LBA       End LBA         Name
      1     0x00000400      0x0000a3ff      "efs"
      5     0x00026420      0x00026c1f      "dtbo"
     12     0x0003f390      0x0074738f      "super"

In that case, the loop in part_get_info_by_name() would break after
partition #1, so any attempt to obtain "dtbo" or "super" partition will
fail. Fix that by continuing to iterate over the remaining partitions to
make sure none of the visible ones is missed. That makes "part" command
(e.g. "part start", "part size") able to work with such tables.

Fixes: 87b8530fe244 ("disk: part: implement generic function part_get_info_by_name()")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
disk/part.c