1. move relocator related code more close to each other 2. use variable "len" since it has correct assignment, and keep coding style with upper code
Signed-off-by: Cao jin <caoj.f...@cn.fujitsu.com> --- grub-core/loader/i386/pc/linux.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c index b69cb7a3a..531b58d37 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -236,10 +236,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), (unsigned) real_size, (unsigned) grub_linux16_prot_size); - relocator = grub_relocator_new (); - if (!relocator) - goto fail; - for (i = 1; i < argc; i++) if (grub_memcmp (argv[i], "vga=", 4) == 0) { @@ -299,6 +295,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } } + relocator = grub_relocator_new (); + if (!relocator) + goto fail; + { grub_relocator_chunk_t ch; err = grub_relocator_alloc_chunk_addr (relocator, &ch, @@ -355,8 +355,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), } len = grub_linux16_prot_size; - if (grub_file_read (file, grub_linux_prot_chunk, grub_linux16_prot_size) - != (grub_ssize_t) grub_linux16_prot_size && !grub_errno) + if (grub_file_read (file, grub_linux_prot_chunk, len) != len && !grub_errno) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), argv[0]); -- 2.17.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel