|
@@ -360,8 +360,11 @@ static int multiboot_load_raw ( struct image *image,
|
360
|
360
|
|
361
|
361
|
/* Verify and prepare segment */
|
362
|
362
|
offset = ( hdr->offset - hdr->mb.header_addr + hdr->mb.load_addr );
|
363
|
|
- filesz = ( hdr->mb.load_end_addr - hdr->mb.load_addr );
|
364
|
|
- memsz = ( hdr->mb.bss_end_addr - hdr->mb.load_addr );
|
|
363
|
+ filesz = ( hdr->mb.load_end_addr ?
|
|
364
|
+ ( hdr->mb.load_end_addr - hdr->mb.load_addr ) :
|
|
365
|
+ ( image->len - offset ) );
|
|
366
|
+ memsz = ( hdr->mb.bss_end_addr ?
|
|
367
|
+ ( hdr->mb.bss_end_addr - hdr->mb.load_addr ) : filesz );
|
365
|
368
|
buffer = phys_to_user ( hdr->mb.load_addr );
|
366
|
369
|
if ( ( rc = prep_segment ( buffer, filesz, memsz ) ) != 0 ) {
|
367
|
370
|
DBGC ( image, "MULTIBOOT %p could not prepare segment: %s\n",
|