From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VsEne-00063S-FR for mharc-grub-devel@gnu.org; Sun, 15 Dec 2013 11:44:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsEnW-0005wb-Uw for grub-devel@gnu.org; Sun, 15 Dec 2013 11:44:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsEnR-0006fq-JK for grub-devel@gnu.org; Sun, 15 Dec 2013 11:44:06 -0500 Received: from mail-ea0-x230.google.com ([2a00:1450:4013:c01::230]:45214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsEnR-0006fl-Bz for grub-devel@gnu.org; Sun, 15 Dec 2013 11:44:01 -0500 Received: by mail-ea0-f176.google.com with SMTP id h14so1743398eaj.35 for ; Sun, 15 Dec 2013 08:44:00 -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=AdFan4rrg/dcaRK9FLwyhlWfFUdSY0zc74KC0373vpc=; b=oakXLdbGl92YTaX0axlRNSV/UeS01XIzTrYyrUNxL/3EqhucJwuC1HOecg67J86uIM 5/aHp9tWrjQmrrNRUHtM84ldK+EiR+2Me4NWHr9aRFokNhkZiy0OismBmksFdIpiW6wC xzqkSUtKGpngpVGZdH1O5oAGdewDpJwWBQ2rsujxVKFaU6Bnd96pl9Xyz5E3DfrmG8R5 98VPZT9wlICGTI85eTkvchj9OWpL5RwLnFQFSONGLq2cyZ8hPZkYu2QfoP+DkNqZ3aPn 7VW7a4+xqRb9rSN6IVW32VLNgklRy2U+8HHZuWOthWSP6Ijgd9pTqkYpuHzn70YaCGG/ pijA== X-Received: by 10.14.119.136 with SMTP id n8mr12465682eeh.82.1387125840476; Sun, 15 Dec 2013 08:44:00 -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 e3sm31911576eeg.11.2013.12.15.08.43.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 15 Dec 2013 08:43:59 -0800 (PST) Message-ID: <52ADDC30.2070101@gmail.com> Date: Sun, 15 Dec 2013 17:43:28 +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: grub-devel@gnu.org 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="iVnpAVNb016FKNkuKe53PF4SOprIXU9Dl" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::230 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 16:44:12 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --iVnpAVNb016FKNkuKe53PF4SOprIXU9Dl 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 > @@ -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 > 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've tested on windows (as applied in phcoder/windows64 branch). It's fast enough as well. So go ahead for all 3 hunks. >> 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 --iVnpAVNb016FKNkuKe53PF4SOprIXU9Dl 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/ iF4EAREKAAYFAlKt3E4ACgkQmBXlbbo5nOtotwD/TsMWjZ/K7UM2wJg6UJ8SGLg3 0G++yi+NaLhDeQ0H2d4A/AtR6+mLxOoMFrfXoosqE2tzxnUy+lbqpacoHr0YHMkM =hFKU -----END PGP SIGNATURE----- --iVnpAVNb016FKNkuKe53PF4SOprIXU9Dl--