The comment on imagemap_lookup() attributes the need for its second
guard to ulong and loff_t sharing a rank on LP64. loff_t is a signed
long long on every target U-Boot builds for, so it never shares a rank
with ulong on ILP32, and the guard is needed regardless: the comparison
is against an unsigned @size, so an underflowing subtraction makes any
range look like it fits.

State the actual reason.

Signed-off-by: Daniel Golle <[email protected]>
---
 boot/imagemap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/boot/imagemap.c b/boot/imagemap.c
index b004aa1644b..e7222d58c93 100644
--- a/boot/imagemap.c
+++ b/boot/imagemap.c
@@ -72,10 +72,10 @@ void *imagemap_lookup(struct udevice *dev, loff_t 
img_offset, ulong size)
                 *
                 *  2) img_offset - r->img_offset <= r->size
                 *     The offset into the region does not exceed the
-                *     region size.  This guard is essential: without it,
-                *     the subtraction in (3) wraps to a huge value on
-                *     LP64 where ulong and loff_t have the same rank
-                *     and the arithmetic is performed as unsigned.
+                *     region size.  This guard is essential: @size is
+                *     unsigned, so without it the subtraction in (3)
+                *     wraps to a huge value and every range appears to
+                *     fit.
                 *
                 *  3) size <= r->size - (img_offset - r->img_offset)
                 *     The requested range fits in the remaining space.
-- 
2.56.0

Reply via email to