From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VsBAw-0001It-Sp for mharc-grub-devel@gnu.org; Sun, 15 Dec 2013 07:52:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsBAp-0001HN-3a for grub-devel@gnu.org; Sun, 15 Dec 2013 07:52:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsBAj-0001ft-Mc for grub-devel@gnu.org; Sun, 15 Dec 2013 07:51:55 -0500 Received: from mail-ee0-x22d.google.com ([2a00:1450:4013:c00::22d]:39953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsBAj-0001fj-BY for grub-devel@gnu.org; Sun, 15 Dec 2013 07:51:49 -0500 Received: by mail-ee0-f45.google.com with SMTP id d49so1689681eek.32 for ; Sun, 15 Dec 2013 04:51:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=OdhrYLOIBodv+GK5FVrFnsj2B9kaPWwaEQh2i8wpOOs=; b=LuyKWk8iVq3e9KIHv+FTiDkg3qyPNUvdiilOuCD4nPkqd1QlCsC8+Fuij7XY7tn3EX wRCoQrCIRW0cOsnKYPsZrxwQGPv1Bky+gX9eI6wtbJ4x0PJpPu+amhHHkDsl7WW/hcab rrdg9nkHwkL0FRYUuXDJzyWPE/KtaSUPH1wZCke+Ngr5UjQwwCSPwJH4ggvxyyvO6E2A 3O7Vj1DQtno+AIbN5ri6LJH5dm7QcI8XDnmWCbJpL4K8zfuJOH6BEcL9LrUxRKDkBXY3 Sln8KcFeY9rA8wJ4stSdp7bNF0s+NxecErqwbfdFlvyHzxWNox6cq1FDtAA8BOuVUG6H K3yQ== X-Received: by 10.14.251.68 with SMTP id a44mr11984101ees.64.1387111908213; Sun, 15 Dec 2013 04:51:48 -0800 (PST) Received: from [192.168.1.16] (85-188.196-178.cust.bluewin.ch. [178.196.188.85]) by mx.google.com with ESMTPSA id z42sm29833858eeo.17.2013.12.15.04.51.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 15 Dec 2013 04:51:47 -0800 (PST) Message-ID: <52ADA5D8.5030309@gmail.com> Date: Sun, 15 Dec 2013 13:51:36 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [PATCH] trivial fixes for windows-efi branch References: <1387094652-14021-1-git-send-email-arvidjaar@gmail.com> <20131215164158.697735fc@opensuse.site> In-Reply-To: <20131215164158.697735fc@opensuse.site> X-Enigmail-Version: 1.6 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="GT44Jt4h2itsrS1vAff2oItMrKugVIsBc" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::22d X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Dec 2013 12:52:00 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GT44Jt4h2itsrS1vAff2oItMrKugVIsBc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 15.12.2013 13:41, Andrey Borzenkov wrote: > =D0=92 Sun, 15 Dec 2013 12:43:49 +0100 > "Vladimir 'phcoder' Serbinenko" =D0=BF=D0=B8=D1=88=D0= =B5=D1=82: >=20 >> Sounds like you're looking at old version. I've fixed those problems a= nd >> it's already merged in master. Could you have a look and say if any of= >> those still a problem? >=20 > Yes, it fixed file path and variable not existed in exhaustive search. > Still see comments below. >=20 > 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 =3D NULL; > ssize_t current_len; > current =3D 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) > { >=20 > Same potential problem with signed vs. unsigned comparison. Variable is= > not guaranteed to exist here and -1 is treated as very large unsigned > value. >=20 Yes, apparently mingw treats here as siged comparison and no warning is emitted. As for the comment, the reasons for possible failure are somewhat unclear to me, other than permission denied one. On Windows you wouldn't get here if permission is denied (you'd stop at token manipulation). Some kind of internal EFI failure may leave some variables unusable while otherwise allowing algorithm to work. > @@ -275,13 +277,18 @@ grub_install_register_efi (grub_device_t > efidir_grub_dev, void *current =3D NULL; > ssize_t current_len; > current =3D get_efi_variable_bootn (i, ¤t_len); > + if (current_len < -1) > + continue; /* FIXME Should we abort on error? */ >=20 > For completeness we should handle failures to avoid crash. >=20 Same. Go ahead for those 2 hunks. > if (current_len =3D=3D -1) > { > - order_num =3D i; > - have_order_num =3D 1; > - grub_util_info ("Creating new entry at Boot%04x", > - order_num); > - break; > + if (!have_order_num) > + { > + order_num =3D i; > + have_order_num =3D 1; > + grub_util_info ("Creating new entry at Boot%04x", > + order_num); > + } > + continue; > } >=20 > 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. >=20 > I cannot test it on Windows; on Linux code appears to be fast enough. >=20 I'll test think hunk on my next reboot. >> As for merging with Linux part we could just hav= e >> primitives set variable and get variable and have everything else shar= ed >=20 > Yes, I'll get a look. >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >=20 --GT44Jt4h2itsrS1vAff2oItMrKugVIsBc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iF4EAREKAAYFAlKtpeIACgkQmBXlbbo5nOv9AwD8C0yy8fvz60CNXuY9C/rpOy7O j3rYZd8ZG0LBi6UtuE0A/2MSweTlHGr0rXsNFawr5TN4H68TX+vdUthAlg6WALhr =ZhE8 -----END PGP SIGNATURE----- --GT44Jt4h2itsrS1vAff2oItMrKugVIsBc--