From: Andrey Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] trivial fixes for windows-efi branch
Date: Sun, 15 Dec 2013 16:41:58 +0400 [thread overview]
Message-ID: <20131215164158.697735fc@opensuse.site> (raw)
In-Reply-To: <CAEaD8JPw=48rJu+CQoPHrmbxK79zcipDj6ePFQB3HgPsHyZC4g@mail.gmail.com>
В Sun, 15 Dec 2013 12:43:49 +0100
"Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com> пишет:
> Sounds like you're looking at old version. I've fixed those problems and
> it's already merged in master. Could you have a look and say if any of
> those still a problem?
Yes, it fixed file path and variable not existed in exhaustive search.
Still see comments below.
diff --git a/grub-core/osdep/windows/platform.c
b/grub-core/osdep/windows/platform.c index b123256..3f4ad5e 100644
--- a/grub-core/osdep/windows/platform.c
+++ b/grub-core/osdep/windows/platform.c
@@ -246,6 +246,8 @@ grub_install_register_efi (grub_device_t
efidir_grub_dev, void *current = NULL;
ssize_t current_len;
current = get_efi_variable_bootn (i, ¤t_len);
+ if (current_len < 0)
+ continue; /* FIXME Should we abort on error? */
if (current_len < (distrib16_len + 1) * sizeof
(grub_uint16_t)
+ 6)
{
Same potential problem with signed vs. unsigned comparison. Variable is
not guaranteed to exist here and -1 is treated as very large unsigned
value.
@@ -275,13 +277,18 @@ grub_install_register_efi (grub_device_t
efidir_grub_dev, void *current = NULL;
ssize_t current_len;
current = get_efi_variable_bootn (i, ¤t_len);
+ if (current_len < -1)
+ continue; /* FIXME Should we abort on error? */
For completeness we should handle failures to avoid crash.
if (current_len == -1)
{
- order_num = i;
- have_order_num = 1;
- grub_util_info ("Creating new entry at Boot%04x",
- order_num);
- break;
+ if (!have_order_num)
+ {
+ order_num = i;
+ have_order_num = 1;
+ grub_util_info ("Creating new entry at Boot%04x",
+ order_num);
+ }
+ continue;
}
You changed it to stop on first non-existing variable; but this can
miss another one later with the same description. This will result in
two different boot entries with the same name.
I cannot test it on Windows; on Linux code appears to be fast enough.
> As for merging with Linux part we could just have
> primitives set variable and get variable and have everything else shared
Yes, I'll get a look.
next prev parent reply other threads:[~2013-12-15 12:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-15 8:04 [PATCH] trivial fixes for windows-efi branch Andrey Borzenkov
2013-12-15 11:43 ` Vladimir 'phcoder' Serbinenko
2013-12-15 12:41 ` Andrey Borzenkov [this message]
2013-12-15 12:51 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-15 16:43 ` Vladimir 'φ-coder/phcoder' Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131215164158.697735fc@opensuse.site \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).