[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/7] add ARM Linux loader
From: |
Francesco Lavra |
Subject: |
Re: [PATCH 6/7] add ARM Linux loader |
Date: |
Sun, 07 Apr 2013 23:17:46 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 |
Hi, I noticed another minor issue in this patch.
On 03/24/2013 06:01 PM, Leif Lindholm wrote:
> --- grub-core/loader/arm/linux.c 1970-01-01 00:00:00 +0000
> +++ grub-core/loader/arm/linux.c 2013-03-24 13:49:04 +0000
[...]
> +static grub_err_t
> +grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
> + int argc, char *argv[])
> +{
> + grub_file_t file;
> + int size;
> +
> + if (argc == 0)
> + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
> +
> + file = grub_file_open (argv[0]);
> + if (!file)
> + return grub_errno;
> +
> + size = grub_file_size (file);
> + if (size == 0)
> + goto fail;
> +
> +#ifdef GRUB_MACHINE_EFI
> + initrd_start = (grub_addr_t) grub_efi_allocate_loader_memory
> (LINUX_INITRD_PHYS_OFFSET, size);
> +#else
> + initrd_start = LINUX_INITRD_ADDRESS;
> +#endif
> + grub_dprintf ("loader", "Loading initrd to 0x%08x\n",
> + (grub_addr_t) initrd_start);
> +
> + if (grub_file_read (file, (void *) initrd_start, size) != size)
> + goto fail;
> +
> + initrd_end = initrd_start + size;
> +
> + return GRUB_ERR_NONE;
The file should be closed also if the initrd is successfully loaded.
> +
> +fail:
> + grub_file_close (file);
> +
> + return grub_errno;
> +}
--
Francesco