efi_loader: do not miss last relocation block
[pandora-u-boot.git] / lib / efi_loader / efi_image_loader.c
index cec17ea..fe66e7b 100644 (file)
@@ -111,7 +111,7 @@ static efi_status_t efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,
                return EFI_SUCCESS;
 
        end = (const IMAGE_BASE_RELOCATION *)((const char *)rel + rel_size);
-       while (rel < end - 1 && rel->SizeOfBlock) {
+       while (rel < end && rel->SizeOfBlock) {
                const uint16_t *relocs = (const uint16_t *)(rel + 1);
                i = (rel->SizeOfBlock - sizeof(*rel)) / sizeof(uint16_t);
                while (i--) {