]> git.ipfire.org Git - thirdparty/u-boot.git/commit
disk: part: fix partition search boundaries
authorMikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Mon, 19 Jan 2026 22:33:03 +0000 (01:33 +0300)
committerTom Rini <trini@konsulko.com>
Wed, 4 Feb 2026 16:30:55 +0000 (10:30 -0600)
commit0ced9ef07361980d1418eab33ee1f41274d1e0e2
treee678fed8e467beb4b793ed45d70e5555d30032af
parent90efb8d394de9df1ae2c20f5e25ffc2009dc7ec5
disk: part: fix partition search boundaries

GPT disk partition with max available number (ex: /dev/mmcblk128) can't
be read/write from U-Boot using read/write command. Here is an example:

  => mmc part

  Partition Map for mmc device 0  --   Partition Type: EFI

  Part Start LBA End LBA Name
Attributes
Type GUID
Partition GUID
  1 0x00001000 0x000013ff "env1"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 5452574f-2211-4433-5566-778899aabb02
  2 0x00001400 0x000017ff "env2"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 5452574f-2211-4433-5566-778899aabb03
  .................
  8 0x00158000 0x0034bfff "apps"
attrs: 0x0000000000000000
type: 0fc63daf-8483-4772-8e79-3d69d8477de4
guid: 5452574f-2211-4433-5566-778899aabb09
  128 0x00000420 0x00000fff "fip"
attrs: 0x0000000000000000
type: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
guid: 5452574f-2211-4433-5566-778899aabb01

  => read mmc 0#fip ${loadaddr} 0 4
  Could not find "fip" partition
  ** Bad device specification mmc 0#fip **
  ** Bad device specification mmc 0#fip **
  Couldn't find partition mmc 0#fip

The error is caused by invalid boundary checks. This patch fixes an
issue.

Fixes: 43fd4bcefd4e ("disk: part: implement generic function part_get_info_by_uuid()")
Fixes: 56670d6fb83f ("disk: part: use common api to lookup part driver")
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Acked-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-By: Michael Trimarchi <michael@amarulasolutions.com>
disk/part.c