ipl: Abort early if we know we will not reach the block

Signed-off-by: Helge Deller <deller@gmx.de>
diff --git a/ipl/offset.c b/ipl/offset.c
index c048461..fb2a6ff 100644
--- a/ipl/offset.c
+++ b/ipl/offset.c
@@ -23,6 +23,13 @@
     if (Debug) printf("offset_read(%d, 0x%p, %d, %lld)\r\n",
 		    fd, buf, count, devaddr);
 
+    /* abort early if we reach firmware limit */
+    if (disk_2gb_limit && ((devaddr + count) >> 31)) {
+	printf("offset_read(%lld): block not reachable via firmware call\r\n",
+		devaddr + count);
+	return -1;
+    }
+
     /* truncate 'count' according to max device/file size */
     if (o->length > 0 && devaddr < o->length && devaddr + count > o->length)
 	count = o->length - devaddr;